use inline template instead of .dist file to populate users.auth.php

users.auth.php is the only file in DokuWiki that is generated by using existing .dist file, instead of inline templates in install.php. This may cause problem when install.php is being run to create animal wiki in farm mode, because in this case DOKU_CONF may have no files at all, so install cannot populate users.auth.php properly. This closes #2845, which may be a result of this behavior - without proper comments at the beginning of the file, once the last authplain user is removed (if users has other auth backend as a proxy of authplain), the whole file will get removed, which causes fatal error.
This commit is contained in:
Phy 2019-09-13 22:27:21 -04:00
parent 8195fb013e
commit a672ef7566
1 changed files with 15 additions and 2 deletions

View File

@ -370,9 +370,22 @@ EOT;
$pass = $phash->hash_smd5($d['password']);
// create users.auth.php
$output = <<<EOT
# users.auth.php
# <?php exit()?>
# Don't modify the lines above
#
# Userfile
#
# Auto-generated by install script
# Date: $now
#
# Format:
# login:passwordhash:Real Name:email:groups,comma,separated
EOT;
// --- user:SMD5password:Real Name:email:groups,comma,seperated
$output = join(":",array($d['superuser'], $pass, $d['fullname'], $d['email'], 'admin,user'));
$output = @file_get_contents(DOKU_CONF.'users.auth.php.dist')."\n$output\n";
$output = $output."\n".join(":",array($d['superuser'], $pass, $d['fullname'], $d['email'], 'admin,user'))."\n";
$ok = $ok && fileWrite(DOKU_LOCAL.'users.auth.php', $output);
// create acl.auth.php