mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-04 07:15:38 +08:00
Add moveFileOrDir method to handle cross-device file and directory moves
This commit is contained in:
31
src/Package/Artifact/imagick.php
Normal file
31
src/Package/Artifact/imagick.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Artifact;
|
||||
|
||||
use StaticPHP\Attribute\Artifact\AfterSourceExtract;
|
||||
use StaticPHP\Attribute\PatchDescription;
|
||||
use StaticPHP\Util\SourcePatcher;
|
||||
|
||||
class imagick
|
||||
{
|
||||
#[AfterSourceExtract('ext-imagick')]
|
||||
#[PatchDescription('Patch imagick for PHP 8.4 compatibility (versions < 3.8.0)')]
|
||||
public function patchImagickWith84(): void
|
||||
{
|
||||
// match imagick version id
|
||||
$file = SOURCE_PATH . '/php-src/ext/imagick/php_imagick.h';
|
||||
if (!file_exists($file)) {
|
||||
return;
|
||||
}
|
||||
$content = file_get_contents($file);
|
||||
if (preg_match('/#define PHP_IMAGICK_EXTNUM\s+(\d+)/', $content, $match) === 0) {
|
||||
return;
|
||||
}
|
||||
$extnum = intval($match[1]);
|
||||
if ($extnum < 30800) {
|
||||
SourcePatcher::patchFile('imagick_php84_before_30800.patch', SOURCE_PATH . '/php-src/ext/imagick');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user