Skip to content

Unblock symfony dependencies #774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 23, 2025
26 changes: 26 additions & 0 deletions bin/check_mysql_downloads.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# List of URLs to check
urls=(
"https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-8.4.3-macos14-arm64.tar.gz"
"https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-8.4.3-macos14-x86_64.tar.gz"
"https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-8.4.3-linux-glibc2.17-aarch64-minimal.tar"
"https://dev.mysql.com/get/Downloads/MySQL-8.4/file/mysql-8.4.3-linux-glibc2.17-x86_64-minimal.tar"
"https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-8.4.3-winx64.zip"
)

# Function to check URL validity
check_url() {
local url=$1
local status_code=$(curl -o /dev/null -s -w "%{http_code}\n" "$url")
if [ "$status_code" -ne 400 ]; then
echo "URL: $url is valid. Status code: $status_code"
else
echo "URL: $url is invalid. Status code: $status_code"
fi
}

# Loop through each URL and check its validity
for url in "${urls[@]}"; do
check_url "$url"
done
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
"ext-curl": "*",
"ext-zip": "*",
"composer-runtime-api": "^2.2",
"phpunit/phpunit": "<=12.0.0",
"phpunit/phpunit": "<12.0.0",
"codeception/codeception": "^5.0",
"codeception/module-asserts": "^2.0 || ^3.0",
"codeception/module-phpbrowser": "^2.0 || ^3.0",
"codeception/module-webdriver": "^2.0 || ^3.0 || ^4.0",
"codeception/module-db": "^2.0 || ^3.0",
"codeception/module-filesystem": "^2.0 || ^3.0",
"codeception/module-cli": "^2.0 || ^3.0",
"symfony/process": ">=4.4.24 <7.0",
"symfony/filesystem": ">=4.4.24 <7.0",
"symfony/process": ">=4.4.24 <8.0",
"symfony/filesystem": ">=4.4.24 <8.0",
"vlucas/phpdotenv": "^5.0",
"druidfi/mysqldump-php": "^1.1"
},
Expand Down
6 changes: 5 additions & 1 deletion includes/opis/closure/src/SerializableClosure.php
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,11 @@ protected function mapPointers(&$data)
break;
}
foreach ($reflection->getProperties() as $property) {
if ($property->isStatic() || !$property->getDeclaringClass()->isUserDefined()) {
if (
$property->isStatic()
|| !$property->getDeclaringClass()->isUserDefined()
|| (method_exists($property, 'isReadOnly') && $property->isReadOnly())
) {
continue;
}
$property->setAccessible(true);
Expand Down
10 changes: 5 additions & 5 deletions src/ManagedProcess/MysqlServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -446,17 +446,17 @@ public function getArchiveUrl(): string

if ($operatingSystem === MachineInformation::OS_DARWIN) {
return $architecture === 'arm64' ?
'https://downloads.mysql.com/archives/get/p/23/file/mysql-8.4.3-macos14-arm64.tar.gz'
: 'https://downloads.mysql.com/archives/get/p/23/file/mysql-8.4.3-macos14-x86_64.tar.gz';
'https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-8.4.3-macos14-arm64.tar.gz'
: 'https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-8.4.3-macos14-x86_64.tar.gz';
}

if ($operatingSystem === MachineInformation::OS_LINUX) {
return $architecture === 'arm64' ?
'https://downloads.mysql.com/archives/get/p/23/file/mysql-8.4.3-linux-glibc2.17-aarch64-minimal.tar'
: 'https://downloads.mysql.com/archives/get/p/23/file/mysql-8.4.3-linux-glibc2.17-x86_64-minimal.tar';
'https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-8.4.3-linux-glibc2.17-aarch64-minimal.tar.xz'
: 'https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-8.4.3-linux-glibc2.17-x86_64-minimal.tar.xz';
}

return 'https://downloads.mysql.com/archives/get/p/23/file/mysql-8.4.3-winx64.zip';
return 'https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-8.4.3-winx64.zip';
}

public function getArchivePath(bool $normalize = false): string
Expand Down
7 changes: 7 additions & 0 deletions src/Utils/Download.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ public static function fileFromUrl(
curl_setopt($curlHandle, CURLOPT_TIMEOUT, 120);
curl_setopt($curlHandle, CURLOPT_FILE, $file);

// Set the user agent header.
curl_setopt(
$curlHandle,
CURLOPT_USERAGENT,
'Mozilla/5.0 (compatible; Embedded MySql; +https://github.com/lucatume/wp-browser'
);

if (!$verifyHost) {
/** @noinspection CurlSslServerSpoofingInspection */
curl_setopt($curlHandle, CURLOPT_SSL_VERIFYHOST, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected function _before()
{
$this->setFunctionReturn('file_put_contents', function (string $file): void {
throw new AssertionFAiledError('Unexpected file_put_contents call for ' . $file);
});
},true);

$this->setClassMock(Process::class, $this->makeEmptyClass(Process::class, [
'__construct' => function (array $command) {
Expand Down
20 changes: 10 additions & 10 deletions tests/unit/lucatume/WPBrowser/ManagedProcess/MysqlServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,32 +71,32 @@ public function osAndArchDataProvider(): array
'windows x86_64' => [
MachineInformation::OS_WINDOWS,
MachineInformation::ARCH_X86_64,
FS::cacheDir() . '/mysql-server/mysql-8.4.2-winx64',
FS::cacheDir() . '/mysql-server/mysql-8.4.2-winx64/bin/mysqld.exe',
FS::cacheDir() . '/mysql-server/mysql-8.4.3-winx64',
FS::cacheDir() . '/mysql-server/mysql-8.4.3-winx64/bin/mysqld.exe',
],
'linux x86_64' => [
MachineInformation::OS_LINUX,
MachineInformation::ARCH_X86_64,
FS::cacheDir() . '/mysql-server/mysql-8.4.2-linux-glibc2.17-x86_64-minimal',
FS::cacheDir() . '/mysql-server/mysql-8.4.2-linux-glibc2.17-x86_64-minimal/bin/mysqld',
FS::cacheDir() . '/mysql-server/mysql-8.4.3-linux-glibc2.17-x86_64-minimal',
FS::cacheDir() . '/mysql-server/mysql-8.4.3-linux-glibc2.17-x86_64-minimal/bin/mysqld',
],
'linux arm64' => [
MachineInformation::OS_LINUX,
MachineInformation::ARCH_ARM64,
FS::cacheDir() . '/mysql-server/mysql-8.4.2-linux-glibc2.17-aarch64-minimal',
FS::cacheDir() . '/mysql-server/mysql-8.4.2-linux-glibc2.17-aarch64-minimal/bin/mysqld',
FS::cacheDir() . '/mysql-server/mysql-8.4.3-linux-glibc2.17-aarch64-minimal',
FS::cacheDir() . '/mysql-server/mysql-8.4.3-linux-glibc2.17-aarch64-minimal/bin/mysqld',
],
'darwin x86_64' => [
MachineInformation::OS_DARWIN,
MachineInformation::ARCH_X86_64,
FS::cacheDir() . '/mysql-server/mysql-8.4.2-macos14-x86_64',
FS::cacheDir() . '/mysql-server/mysql-8.4.2-macos14-x86_64/bin/mysqld',
FS::cacheDir() . '/mysql-server/mysql-8.4.3-macos14-x86_64',
FS::cacheDir() . '/mysql-server/mysql-8.4.3-macos14-x86_64/bin/mysqld',
],
'darwin arm64' => [
MachineInformation::OS_DARWIN,
MachineInformation::ARCH_ARM64,
FS::cacheDir() . '/mysql-server/mysql-8.4.2-macos14-arm64',
FS::cacheDir() . '/mysql-server/mysql-8.4.2-macos14-arm64/bin/mysqld',
FS::cacheDir() . '/mysql-server/mysql-8.4.3-macos14-arm64',
FS::cacheDir() . '/mysql-server/mysql-8.4.3-macos14-arm64/bin/mysqld',
]
];
}
Expand Down