Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
init_admin_passwd.php
Go to the documentation of this file.
1 #!/usr/bin/env php
2 <?php
3 /*
4  * @author Anakeen
5  * @package FDL
6 */
7 
8 $WIFF_ROOT = getenv("WIFF_ROOT");
9 if ($WIFF_ROOT === false) {
10  print "WIFF_ROOT environment variable is not set!\n";
11  exit(1);
12 }
13 
14 $WIFF_CONTEXT_ROOT = getenv("WIFF_CONTEXT_ROOT");
15 if ($WIFF_CONTEXT_ROOT === false) {
16  print "WIFF_CONTEXT_ROOT environment variable not set!\n";
17  exit(1);
18 }
19 
20 set_include_path(get_include_path() . PATH_SEPARATOR . $WIFF_CONTEXT_ROOT . PATH_SEPARATOR . "$WIFF_ROOT/include");
21 
22 $prefix = $WIFF_CONTEXT_ROOT . "/WHAT/Lib.Prefix.php";
23 if (!include ($prefix)) {
24  print "cannot include file $prefix";
25  exit(1);
26 }
27 
28 include_once ('lib/Lib.Cli.php');
29 include_once ('WHAT/Lib.Common.php');
30 include_once ('WHAT/Class.User.php');
31 
32 $admin_passwd = wiff_getParamValue('core_admin_passwd');
33 if ($admin_passwd == '') {
34  print "Empty core_admin_passwd.";
35  exit(1);
36 }
37 
39 
41 if (!is_object($user) || !$user->isAffected()) {
42  print "Could not find user with id '1' (admin).";
43  exit(1);
44 }
45 
46 $user->computepass($admin_passwd, $user->password);
47 $err = $user->modify(true, '', true);
48 if ($err != '') {
49  print sprintf("Modify returned with error: %s", $err);
50  exit(1);
51 }
52 
53 $err = $user->setAdminHtpasswd($admin_passwd);
54 if ($err != '') {
55  print sprintf("Error setting password in 'admin/.htpasswd': %s", $err);
56  exit(1);
57 }
58 
59 exit(0);
$admin_passwd
$WIFF_ROOT
if($admin_passwd== '') $dbaccess
print
Definition: checklist.php:49
getDbAccess()
Definition: Lib.Common.php:368
switch($command) exit
Definition: checkVault.php:46
if($WIFF_ROOT===false) $WIFF_CONTEXT_ROOT
← centre documentaire © anakeen