mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-04 23:35:40 +08:00
Fix several patches & newer phpmicro support (#470)
* use upstream phpmicro * move src/global/tests to src/global/ext-tests * move src/global/tests to src/global/ext-tests * prevent file_get_contents memory insufficience * update README * fix libxml >= 2.12 with older PHP (<=8.1) build bug * cleanup code, support newer phpmicro * add --no-strip and --with-upx-pack tests * fix windows sanity check for newer phpmicro * fix windows sanity check for newer phpmicro * test * test * test * update deps for ci
This commit is contained in:
@@ -436,6 +436,21 @@ class FileSystem
|
||||
return str_replace(array_keys($replacement), array_values($replacement), $path);
|
||||
}
|
||||
|
||||
public static function backupFile(string $path): string
|
||||
{
|
||||
copy($path, $path . '.bak');
|
||||
return $path . '.bak';
|
||||
}
|
||||
|
||||
public static function restoreBackupFile(string $path): void
|
||||
{
|
||||
if (!file_exists($path . '.bak')) {
|
||||
throw new RuntimeException('Cannot find bak file for ' . $path);
|
||||
}
|
||||
copy($path . '.bak', $path);
|
||||
unlink($path . '.bak');
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
* @throws FileSystemException
|
||||
|
||||
Reference in New Issue
Block a user