2026-03-30 14:54:57 +07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Safe;
|
|
|
|
|
|
|
|
|
|
use Safe\Exceptions\OpcacheException;
|
|
|
|
|
|
|
|
|
|
/**
|
2026-04-18 20:32:18 +07:00
|
|
|
* @param string $filename
|
2026-03-30 14:54:57 +07:00
|
|
|
* @throws OpcacheException
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
function opcache_compile_file(string $filename): void
|
|
|
|
|
{
|
|
|
|
|
error_clear_last();
|
|
|
|
|
$safeResult = \opcache_compile_file($filename);
|
|
|
|
|
if ($safeResult === false) {
|
|
|
|
|
throw OpcacheException::createFromPhpError();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2026-04-18 20:32:18 +07:00
|
|
|
* @param bool $include_scripts
|
|
|
|
|
* @return array
|
2026-03-30 14:54:57 +07:00
|
|
|
* @throws OpcacheException
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
function opcache_get_status(bool $include_scripts = true): array
|
|
|
|
|
{
|
|
|
|
|
error_clear_last();
|
|
|
|
|
$safeResult = \opcache_get_status($include_scripts);
|
|
|
|
|
if ($safeResult === false) {
|
|
|
|
|
throw OpcacheException::createFromPhpError();
|
|
|
|
|
}
|
|
|
|
|
return $safeResult;
|
|
|
|
|
}
|