diff --git a/core/modules/system/lib/Drupal/system/Tests/System/ScriptTest.php b/core/modules/system/lib/Drupal/system/Tests/System/ScriptTest.php index 9ba2e5c..773cfa0 100644 --- a/core/modules/system/lib/Drupal/system/Tests/System/ScriptTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/ScriptTest.php @@ -45,6 +45,14 @@ public function testPasswordHashSh() { * Tests rebuild_token_calculator.sh. */ public function testRebuildTokenCalculatorSh() { + // The script requires a settings.php with a hash salt setting. + $filename = $this->siteDirectory . '/settings.php'; + touch($filename); + $settings['settings']['hash_salt'] = (object) array( + 'value' => 'some_random_key', + 'required' => TRUE, + ); + drupal_rewrite_settings($settings, $filename); $_SERVER['argv'] = array( 'core/scripts/rebuild_token_calculator.sh', ); diff --git a/core/scripts/rebuild_token_calculator.sh b/core/scripts/rebuild_token_calculator.sh index 8168c2b..bcfd2b6 100755 --- a/core/scripts/rebuild_token_calculator.sh +++ b/core/scripts/rebuild_token_calculator.sh @@ -18,10 +18,11 @@ return; } -$autoloader = require __DIR__ . '/../vendor/autoload.php'; +require __DIR__ . '/../vendor/autoload.php'; +require_once __DIR__ . '/../includes/bootstrap.inc'; + $request = Request::createFromGlobals(); -$kernel = new DrupalKernel('prod', $autoloader); -$kernel->boot($request); +Settings::initialize(DrupalKernel::findSitePath($request)); $timestamp = time(); $token = Crypt::hmacBase64($timestamp, Settings::get('hash_salt'));