feat(yeswiki-installer) : nossl option

This commit is contained in:
mrflos 2023-04-20 19:28:54 +03:00
parent 2b76cdc7e6
commit 792e4489ff
3 changed files with 99 additions and 32 deletions

View file

@ -56,6 +56,12 @@ if (0 == posix_getuid()) {
'description' => 'Say yes to every confirmation check (no prompt)',
'noValue' => true,
],
'nossl' => [
'prefix' => 'nossl',
'longPrefix' => 'no-ssl-certificate',
'description' => 'No SSL certificate and no DNS check',
'noValue' => true,
],
]);
$climate->arguments->parse();
$domain = $climate->arguments->get('domain');
@ -64,10 +70,13 @@ if (0 == posix_getuid()) {
$quota = $climate->arguments->get('quota');
$type = $climate->arguments->get('type');
$confirm = $climate->arguments->get('confirm');
$nossl = $climate->arguments->get('nossl');
$herseUser = $climate->arguments->get('herseuser');
$hersePass = $climate->arguments->get('hersepass');
$isFullDomain = !preg_match('/.'.$_SERVER['maindomain'].'$/isU', $domain, $matches, PREG_OFFSET_CAPTURE, 0);
checkDNS($domain, $isFullDomain);
if (!$nossl) {
checkDNS($domain, $isFullDomain);
}
checkIfInstalled($domain);
$needHerse = checkHerse($herseUser, $hersePass);
$user = generateUserFromDomain($domain);
@ -77,15 +86,15 @@ if (0 == posix_getuid()) {
if ($confirm || $input->confirmed()) {
$unixUser = createUnixUserWithQuota($user, $quota);
$dbUser = createSQLUserAndDatabase($user, $type);
createNginxConfig($domain, $user, $herseUser, $hersePass);
createNginxConfig($domain, $user, $herseUser, $hersePass, $nossl);
createPhpFpmConfig($user);
if ($needHerse) {
copyYesWikiFiles($domain, $user, $dbUser, $herseUser, $hersePass);
copyYesWikiFiles($domain, $user, $dbUser, $herseUser, $hersePass, $nossl);
} else {
copyYesWikiFiles($domain, $user, $dbUser);
copyYesWikiFiles($domain, $user, $dbUser, null, null, $nossl);
}
$climate->shout(
'The yeswiki was successfully installed on <bold>https://'.$domain.'</bold>, congrats ! 🎉'."\n"
'The yeswiki was successfully installed on <bold>http'.($nossl ? '' : 's').'://'.$domain.'</bold>, congrats ! 🎉'."\n"
.' Unix user : <bold>'.$unixUser['user'].'</bold> with password : <bold>'.$unixUser['password'].'</bold> was created.'."\n"
.'MySQL user : <bold>'.$dbUser['user'].'</bold> with password : <bold>'.$dbUser['password'].'</bold> was created for database <bold>'.$dbUser['database'].'</bold>.'."\n"
);