diff --git a/core/rebuild.php b/core/rebuild.php index 024b4e6..9ecf17d 100644 --- a/core/rebuild.php +++ b/core/rebuild.php @@ -10,13 +10,14 @@ use Drupal\Component\PhpStorage\PhpStorageFactory; use Drupal\Core\Cache\CacheFactory; +use Drupal\Component\Utility\Crypt; // Change the directory to the Drupal root. chdir('..'); require_once dirname(__DIR__) . '/core/includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION); -if (isset($_GET['token']) && isset($_GET['timestamp']) && REQUEST_TIME - $_GET['timestamp'] < 300 && $_GET['token'] === drupal_hmac_base64($_GET['timestamp'], $GLOBALS['drupal_hash_salt'])) { +if (isset($_GET['token']) && isset($_GET['timestamp']) && REQUEST_TIME - $_GET['timestamp'] < 300 && $_GET['token'] === ($_GET['timestamp'], $GLOBALS['drupal_hash_salt'])) { // drupal_bootstrap(DRUPAL_BOOTSTRAP_KERNEL) will build a new kernel. PhpStorageFactory::get('service_container')->deleteAll(); PhpStorageFactory::get('twig')->deleteAll(); diff --git a/core/scripts/rebuild_token_calculator.sh b/core/scripts/rebuild_token_calculator.sh old mode 100644 new mode 100755 index 92a02aa..2369cd8 --- a/core/scripts/rebuild_token_calculator.sh +++ b/core/scripts/rebuild_token_calculator.sh @@ -6,12 +6,15 @@ * Command line token calculator for rebuild.php. */ +require_once __DIR__ . '/../vendor/autoload.php'; + +use Drupal\Component\Utility\Crypt; + if (PHP_SAPI !== 'cli') { exit; } -$core = dirname(__DIR__); -include dirname($core) . '/sites/default/settings.php'; -include $core . '/includes/bootstrap.inc'; + $timestamp = time(); -$token = drupal_hmac_base64($timestamp, $drupal_hash_salt); +$token = Crypt::hmacBase64($timestamp, $drupal_hash_salt); + print "timestamp=$timestamp&token=$token\n";