2023-05-17 15:24:45 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\extension;
|
|
|
|
|
|
|
|
|
|
use SPC\builder\Extension;
|
2023-12-10 18:27:52 +08:00
|
|
|
use SPC\exception\RuntimeException;
|
|
|
|
|
use SPC\exception\WrongUsageException;
|
2023-05-17 15:24:45 +08:00
|
|
|
use SPC\util\CustomExt;
|
|
|
|
|
|
|
|
|
|
#[CustomExt('opcache')]
|
|
|
|
|
class opcache extends Extension
|
|
|
|
|
{
|
2023-12-10 18:27:52 +08:00
|
|
|
/**
|
|
|
|
|
* @throws WrongUsageException
|
|
|
|
|
* @throws RuntimeException
|
|
|
|
|
*/
|
2024-05-16 13:01:11 +08:00
|
|
|
public function validate(): void
|
2023-12-10 18:27:52 +08:00
|
|
|
{
|
2024-05-21 14:56:54 +08:00
|
|
|
if ($this->builder->getPHPVersionID() < 80000 && getenv('SPC_SKIP_PHP_VERSION_CHECK') !== 'yes') {
|
2023-12-10 18:27:52 +08:00
|
|
|
throw new WrongUsageException('Statically compiled PHP with Zend Opcache only available for PHP >= 8.0 !');
|
|
|
|
|
}
|
2024-05-16 13:01:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getUnixConfigureArg(): string
|
|
|
|
|
{
|
2023-12-10 18:27:52 +08:00
|
|
|
return '--enable-opcache';
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-17 15:24:45 +08:00
|
|
|
public function getDistName(): string
|
|
|
|
|
{
|
|
|
|
|
return 'Zend Opcache';
|
|
|
|
|
}
|
|
|
|
|
}
|