mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-17 05:45:35 +08:00
Apply phpmicro phar patch changes in feat/pgo-v3
This commit is contained in:
@@ -173,6 +173,9 @@ class SourcePatcher
|
|||||||
*/
|
*/
|
||||||
public static function patchMicroPhar(int $version_id): void
|
public static function patchMicroPhar(int $version_id): void
|
||||||
{
|
{
|
||||||
|
if (file_exists(SOURCE_PATH . '/php-src/ext/phar/phar.c.bak')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
FileSystem::backupFile(SOURCE_PATH . '/php-src/ext/phar/phar.c');
|
FileSystem::backupFile(SOURCE_PATH . '/php-src/ext/phar/phar.c');
|
||||||
FileSystem::replaceFileStr(
|
FileSystem::replaceFileStr(
|
||||||
SOURCE_PATH . '/php-src/ext/phar/phar.c',
|
SOURCE_PATH . '/php-src/ext/phar/phar.c',
|
||||||
@@ -198,6 +201,12 @@ class SourcePatcher
|
|||||||
|
|
||||||
public static function unpatchMicroPhar(): void
|
public static function unpatchMicroPhar(): void
|
||||||
{
|
{
|
||||||
|
// Tolerate a missing .bak: both drivers call this, and the first restore
|
||||||
|
// consumes the backup. Without this guard the second call throws
|
||||||
|
// "Cannot find bak file". No .bak means the source is already pristine.
|
||||||
|
if (!file_exists(SOURCE_PATH . '/php-src/ext/phar/phar.c.bak')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
FileSystem::restoreBackupFile(SOURCE_PATH . '/php-src/ext/phar/phar.c');
|
FileSystem::restoreBackupFile(SOURCE_PATH . '/php-src/ext/phar/phar.c');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user