OpcodeCache.php in Automatic Updates 8
File
src/ReadinessChecker/OpcodeCache.php
View source
<?php
namespace Drupal\automatic_updates\ReadinessChecker;
use Drupal\Core\StringTranslation\StringTranslationTrait;
class OpcodeCache implements ReadinessCheckerInterface {
use StringTranslationTrait;
public function run() {
$messages = [];
if ($this
->isCli() && $this
->hasOpcodeFileCache()) {
$messages[] = $this
->t('Automatic updates cannot run via CLI when opcode file cache is enabled.');
}
return $messages;
}
protected function isCli() {
return PHP_SAPI === 'cli';
}
protected function hasOpcodeFileCache() {
if (!ini_get('opcache.validate_timestamps')) {
return TRUE;
}
if (ini_get('opcache.revalidate_freq') > 2) {
return TRUE;
}
return FALSE;
}
}
Classes
Name |
Description |
OpcodeCache |
Error if opcode caching is enabled and updates are executed via CLI. |