rebuild_token_calculator.sh 649 Bytes
Newer Older
1 2 3 4 5 6 7 8 9
#!/usr/bin/env php
<?php

/**
 * @file
 * Command line token calculator for rebuild.php.
 */

use Drupal\Component\Utility\Crypt;
10
use Drupal\Core\DrupalKernel;
11
use Drupal\Core\Site\Settings;
12
use Symfony\Component\HttpFoundation\Request;
13

14
if (PHP_SAPI !== 'cli') {
15
  return;
16 17
}

18
$autoloader = require __DIR__ . '/../../autoload.php';
19
require_once __DIR__ . '/../includes/bootstrap.inc';
20

21
$request = Request::createFromGlobals();
22
Settings::initialize(DRUPAL_ROOT, DrupalKernel::findSitePath($request), $autoloader);
23

24
$timestamp = time();
25
$token = Crypt::hmacBase64($timestamp, Settings::get('hash_salt'));
26 27

print "timestamp=$timestamp&token=$token\n";