Commit c32b474c authored by catch's avatar catch

Issue #2639878 by RobLoach, omega8cc, memtkmcc: Use less demanding check to...

Issue #2639878 by RobLoach, omega8cc, memtkmcc: Use less demanding check to see if OPcache is active
parent a7603d90
......@@ -5,6 +5,8 @@
* Initiates a browser-based installation of Drupal.
*/
use Drupal\Component\Utility\OpCodeCache;
// Change the directory to the Drupal root.
chdir('..');
// Store the Drupal root path.
......@@ -28,12 +30,15 @@
exit;
}
if (function_exists('opcache_get_status') && opcache_get_status()['opcache_enabled'] && !ini_get('opcache.save_comments')) {
// Initialize the autoloader.
$class_loader = require_once $root_path . '/autoload.php';
// If OPCache is in use, ensure opcache.save_comments is enabled.
if (OpCodeCache::isEnabled() && !ini_get('opcache.save_comments')) {
print 'Systems with OPcache installed must have <a href="http://php.net/manual/en/opcache.configuration.php#ini.opcache.save-comments">opcache.save_comments</a> enabled.';
exit();
}
// Start the installer.
$class_loader = require_once $root_path . '/autoload.php';
require_once $root_path . '/core/includes/install.core.inc';
install_drupal($class_loader);
......@@ -9,6 +9,16 @@
*/
class OpCodeCache {
/**
* Checks if OpCodeCache is enabled.
*
* @return bool
* TRUE if opcache is enabled, FALSE otherwise.
*/
public static function isEnabled() {
return extension_loaded('Zend OPcache') && ini_get('opcache.enable');
}
/**
* Invalidates a PHP file from a possibly active opcode cache.
*
......
......@@ -7,6 +7,7 @@
use Drupal\Component\Utility\Crypt;
use Drupal\Component\Utility\Environment;
use Drupal\Component\Utility\OpCodeCache;
use Drupal\Core\Path\AliasStorage;
use Drupal\Core\Url;
use Drupal\Core\Database\Database;
......@@ -242,8 +243,7 @@ function system_requirements($phase) {
if ($phase == 'install' || $phase == 'runtime') {
// Check to see if OPcache is installed.
$opcache_enabled = (function_exists('opcache_get_status') && opcache_get_status()['opcache_enabled']);
if (!$opcache_enabled) {
if (!OpCodeCache::isEnabled()) {
$requirements['php_opcache'] = array(
'value' => t('Not enabled'),
'severity' => REQUIREMENT_WARNING,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment