yeswiki-installer/yeswiki-installer.php

45 lines
1.5 KiB
PHP
Raw Normal View History

#!/usr/bin/php
<?php
require_once('vendor/autoload.php');
require_once('yeswiki-installer.utils.inc.php');
$climate = new League\CLImate\CLImate;
$climate->description('yeswiki-installer, install YesWiki like a professionnal 🌈🦄');
$climate->arguments->add([
'domain' => [
'prefix' => 'd',
'longPrefix' => 'domain',
'description' => 'Domain name used for installation',
'required' => true,
'defaultValue' => 'example.com'
],
'type' => [
'prefix' => 't',
'longPrefix' => 'type',
'description' => 'Type of installation, can be "solo" or "ferme"',
'required' => true,
'defaultValue' => 'solo'
],
'quota' => [
'prefix' => 'q',
'longPrefix' => 'quota',
'description' => 'User quota for hard drive space, in bytes',
'required' => true,
'defaultValue' => 2000000,
'castTo' => 'int'
],
]);
$climate->arguments->parse();
$domain = $climate->arguments->get('domain');
if (!empty($domain) && $domain !== 'example.com') {
$climate->bold()->underline()->out('Installation of YesWiki on '.$domain);
$res = installYesWiki($domain, $climate->arguments->get('quota'), $climate->arguments->get('type'));
if (!empty($res['error'])) {
$climate->error('ERROR : '.$res['error']);
} else {
$climate->dump($res);
}
} else {
$climate->usage();
}