Merge branch 'main' into rename

This commit is contained in:
Marc 2025-11-30 16:09:18 +01:00 committed by GitHub
commit 95bb4cb018
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 10 deletions

View File

@ -34,7 +34,7 @@ use Symfony\Component\Console\Application;
*/ */
final class ConsoleApplication extends Application final class ConsoleApplication extends Application
{ {
public const string VERSION = '2.7.8'; public const string VERSION = '2.7.9';
public function __construct() public function __construct()
{ {

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace SPC\builder\extension; namespace SPC\builder\extension;
use SPC\builder\Extension; use SPC\builder\Extension;
use SPC\store\FileSystem;
use SPC\util\CustomExt; use SPC\util\CustomExt;
#[CustomExt('maxminddb')] #[CustomExt('maxminddb')]
@ -12,15 +13,13 @@ class maxminddb extends Extension
{ {
public function patchBeforeBuildconf(): bool public function patchBeforeBuildconf(): bool
{ {
if (!is_link(SOURCE_PATH . '/php-src/ext/maxminddb')) { if (!is_dir(SOURCE_PATH . '/php-src/ext/maxminddb')) {
$original = $this->source_dir; $original = $this->source_dir;
if (PHP_OS_FAMILY === 'Windows') { FileSystem::copyDir($original . '/ext', SOURCE_PATH . '/php-src/ext/maxminddb');
f_passthru('cd ' . SOURCE_PATH . '/php-src/ext && mklink /D maxminddb ' . $original . '\ext'); $this->source_dir = SOURCE_PATH . '/php-src/ext/maxminddb';
} else {
f_passthru('cd ' . SOURCE_PATH . '/php-src/ext && ln -s ' . $original . '/ext maxminddb');
}
return true; return true;
} }
$this->source_dir = SOURCE_PATH . '/php-src/ext/maxminddb';
return false; return false;
} }
} }

View File

@ -660,11 +660,19 @@ class FileSystem
$source = self::convertPath($source); $source = self::convertPath($source);
$dest = self::convertPath($dest); $dest = self::convertPath($dest);
// Try rename first (fast, atomic) // Check if source and dest are on the same device to avoid cross-device rename errors
if (@rename($source, $dest)) { $source_stat = @stat($source);
return; $dest_parent = dirname($dest);
$dest_stat = @stat($dest_parent);
// Only use rename if on same device
if ($source_stat !== false && $dest_stat !== false && $source_stat['dev'] === $dest_stat['dev']) {
if (@rename($source, $dest)) {
return;
}
} }
// Fall back to copy + delete for cross-device moves or if rename failed
if (is_dir($source)) { if (is_dir($source)) {
self::copyDir($source, $dest); self::copyDir($source, $dest);
self::removeDir($source); self::removeDir($source);