diff --git a/utils.inc.php b/utils.inc.php index 5405003..12391ce 100644 --- a/utils.inc.php +++ b/utils.inc.php @@ -150,6 +150,7 @@ function createNginxConfig($domain, $user, $herseUser, $hersePass) throw new Exception('You need an username AND a password to add a herse.'); } else { // add password file to domain + exec('mkdir -p /home'.'/'.$user.'/'.$domain); file_put_contents( '/home'.'/'.$user.'/'.$domain.'/.htpasswd', $herseUser.':'.password_hash($hersePass, PASSWORD_BCRYPT) @@ -233,7 +234,7 @@ function copyYesWikiFiles($domain, $user, $dbUser, $herseUser = null, $hersePass unlink($tmpFile); $herse = ''; if (!empty($herseUser) && !empty($hersePass)) { - $herse = $herseUser.':'.$hersePass; + $herse = $herseUser.':'.$hersePass.'@'; } $curl = 'curl -X POST --insecure --data-urlencode \'config[default_language]=fr\' --data-urlencode \'config[wakka_name]='.$domain.'\' --data-urlencode \'config[root_page]=PagePrincipale\' --data-urlencode \'config[mysql_host]=localhost\' --data-urlencode \'config[mysql_database]='.$dbUser['database'].'\' --data-urlencode \'config[mysql_user]='.$dbUser['user'].'\' --data-urlencode \'config[mysql_password]='.$dbUser['password'].'\' --data-urlencode \'config[table_prefix]=yeswiki_\' --data-urlencode \'admin_name='.$_SERVER['admin_id'].'\' --data-urlencode \'admin_password='.$_SERVER['admin_password'].'\' --data-urlencode \'admin_password_conf='.$_SERVER['admin_password'].'\' --data-urlencode \'admin_email='.$_SERVER['admin_email'].'\' --data-urlencode \'config[rewrite_mode]=0\' --data-urlencode \'config[allow_raw_html]=1\' --data-urlencode \'config[allow_robots]=1\' --data-urlencode \'submit=Continue\' \'https://'.$herse.$domain.'/?PagePrincipale&installAction=install\' 2>&1'; $output = []; diff --git a/yeswiki-installer.php b/yeswiki-installer.php index 4519b87..958bf5d 100755 --- a/yeswiki-installer.php +++ b/yeswiki-installer.php @@ -76,13 +76,13 @@ if (0 == posix_getuid()) { if ($confirm || $input->confirmed()) { $unixUser = createUnixUserWithQuota($user, $quota); $dbUser = createSQLUserAndDatabase($user, $type); + createNginxConfig($domain, $user, $herseUser, $hersePass); + createPhpFpmConfig($user); if ($needHerse) { copyYesWikiFiles($domain, $user, $dbUser, $herseUser, $hersePass); } else { copyYesWikiFiles($domain, $user, $dbUser); } - createNginxConfig($domain, $user, $herseUser, $hersePass); - createPhpFpmConfig($user); $climate->shout( 'The yeswiki was successfully installed on '.$domain.', congrats ! 🎉'."\n" .' Unix user : '.$unixUser['user'].' with password : '.$unixUser['password'].' was created.'."\n"