| 1 |
#!/usr/bin/php
|
| 2 |
<?php
|
| 3 |
# Script to install a new Drupal site from commandline in a multisite
|
| 4 |
function maint_reset_su_pw_print_help() {
|
| 5 |
print "usage: maint_reset_supw.php domain password\n";
|
| 6 |
exit;
|
| 7 |
}
|
| 8 |
|
| 9 |
|
| 10 |
/**
|
| 11 |
* include the configuration settings.
|
| 12 |
*/
|
| 13 |
include_once('script_settings.php');
|
| 14 |
|
| 15 |
/**
|
| 16 |
* include the parser
|
| 17 |
*/
|
| 18 |
include_once('common.php');
|
| 19 |
|
| 20 |
/**
|
| 21 |
* This is where the action happens.
|
| 22 |
* Three functions are always ran: to create the directories, create the settings file and insert the data. The rest is pluggable.
|
| 23 |
* TODO we check for hardcoded variables. This should be made flexible, but kept secure....
|
| 24 |
*/
|
| 25 |
if (($domain = $argv[1]) &&
|
| 26 |
($password = $argv[2])) {
|
| 27 |
/**
|
| 28 |
* Include Drupal
|
| 29 |
*/
|
| 30 |
include_once('drupal.php');
|
| 31 |
installer_include_drupal($domain);
|
| 32 |
db_query("UPDATE users SET pass = md5('%s')", $password);
|
| 33 |
print "\nPassword is reset\n";
|
| 34 |
}
|
| 35 |
else {
|
| 36 |
maint_reset_su_pw_print_help();
|
| 37 |
}
|
| 38 |
|
| 39 |
?>
|