Same filename and directory in other branches
  1. 8.9.x core/scripts/rebuild_token_calculator.sh
  2. 9 core/scripts/rebuild_token_calculator.sh

Command line token calculator for rebuild.php.

File

core/scripts/rebuild_token_calculator.sh
View source
  1. #!/usr/bin/env php
  2. /**
  3. * @file
  4. * Command line token calculator for rebuild.php.
  5. */
  6. use Drupal\Component\Utility\Crypt;
  7. use Drupal\Core\DrupalKernel;
  8. use Drupal\Core\Site\Settings;
  9. use Symfony\Component\HttpFoundation\Request;
  10. if (PHP_SAPI !== 'cli') {
  11. return;
  12. }
  13. $autoloader = require __DIR__ . '/../../autoload.php';
  14. $request = Request::createFromGlobals();
  15. Settings::initialize(DRUPAL_ROOT, DrupalKernel::findSitePath($request), $autoloader);
  16. $timestamp = time();
  17. $token = Crypt::hmacBase64($timestamp, Settings::get('hash_salt'));
  18. print "timestamp=$timestamp&token=$token\n";