Chris@0: #!/usr/bin/env php Chris@0: " Chris@0: Example: {$script} "mynewpassword" Chris@0: Chris@0: All arguments are long options. Chris@0: Chris@0: --help Print this page. Chris@0: Chris@0: "" ["" ["" ...]] Chris@0: Chris@0: One or more plan-text passwords enclosed by double quotes. The Chris@0: output hash may be manually entered into the Chris@0: {users_field_data}.pass field to change a password via SQL to a Chris@0: known value. Chris@0: Chris@0: Chris@0: EOF; Chris@0: exit; Chris@0: } Chris@0: Chris@0: // Password list to be processed. Chris@0: $passwords = $_SERVER['argv']; Chris@0: Chris@0: $autoloader = require __DIR__ . '/../../autoload.php'; Chris@0: Chris@0: $request = Request::createFromGlobals(); Chris@0: $kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod', FALSE); Chris@0: $kernel->boot(); Chris@0: Chris@0: $password_hasher = $kernel->getContainer()->get('password'); Chris@0: Chris@0: foreach ($passwords as $password) { Chris@14: print("\npassword: $password \t\thash: " . $password_hasher->hash($password) . "\n"); Chris@0: } Chris@0: print("\n");