Commit 2c5978cc authored by catch's avatar catch

Issue #779482 by mikeytown2, sun, cam8001, dalin, segi, alexpott, Sweetchuck,...

Issue #779482 by mikeytown2, sun, cam8001, dalin, segi, alexpott, Sweetchuck, jbrown: Installation failure when opcode cache is enabled.
parent 3a5e9974
......@@ -7,6 +7,7 @@
use Symfony\Component\HttpFoundation\RedirectResponse;
use Drupal\Component\Utility\Crypt;
use Drupal\Component\Utility\OpCodeCache;
use Drupal\Component\Utility\Settings;
use Drupal\Core\Database\Database;
use Drupal\Core\DrupalKernel;
......@@ -324,6 +325,11 @@ function drupal_rewrite_settings($settings = array(), $settings_file = NULL) {
$old_settings = Settings::getAll();
new Settings($settings_settings + $old_settings);
}
// The existing settings.php file might have been included already. In
// case an opcode cache is enabled, the rewritten contents of the file
// will not be reflected in this process. Ensure to invalidate the file
// in case an opcode cache is enabled.
OpCodeCache::invalidate(DRUPAL_ROOT . '/' . $settings_file);
}
}
else {
......
<?php
/**
* @file
* Contains \Drupal\Component\Utility\OpCodeCache.
*/
namespace Drupal\Component\Utility;
/**
* Provides helpers to handle PHP opcode caches.
*
* @ingroup utility
*/
class OpCodeCache {
/**
* Invalidates a PHP file from a possibly active opcode cache.
*
* In case the opcode cache does not support to invalidate an individual file,
* the entire cache will be flushed.
*
* @param string $pathname
* The absolute pathname of the PHP file to invalidate.
*/
public static function invalidate($pathname) {
clearstatcache(TRUE, $pathname);
if (extension_loaded('Zend OPcache')) {
opcache_invalidate($pathname, TRUE);
}
if (extension_loaded('apc')) {
// apc_delete_file() throws a PHP warning in case the specified file was
// not compiled yet.
// @see http://php.net/manual/en/function.apc-delete-file.php
@apc_delete_file($pathname);
}
}
}
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