Bugfixings

- moved testargs.php to util directory
- Switch Environment check before config at automatic install
- checkPHP() is now finding the PHP binary too
- Bugfixing checkPHP() & required returned wrong status
- removing not used $_POST['phpath'] in web installer
This commit is contained in:
Philipp Holzer 2018-10-30 11:30:19 +01:00
parent f0382ab919
commit cf39c9df81
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5
5 changed files with 77 additions and 36 deletions

View file

@ -78,6 +78,20 @@ HELP;
$installer = new Installer();
$this->out(" Complete!\n\n");
// Check Environment
$this->out("Checking environment...\n");
$installer->resetChecks();
if (!$this->runBasicChecks($installer)) {
$errorMessage = $this->extractErrors($installer->getChecks());
throw new RuntimeException($errorMessage);
}
$this->out(" Complete!\n\n");
// if a config file is set,
$config_file = $this->getOption(['f', 'file']);
@ -111,6 +125,10 @@ HELP;
$tz = $this->getOption(['T', 'tz'], (!empty('FRIENDICA_TZ')) ? getenv('FRIENDICA_TZ') : '');
$lang = $this->getOption(['L', 'lang'], (!empty('FRIENDICA_LANG')) ? getenv('FRIENDICA_LANG') : '');
if (empty($php_path)) {
$php_path = $installer->getPHPPath();
}
$installer->createConfig(
$php_path,
$url_path,
@ -127,18 +145,6 @@ HELP;
$this->out(" Complete!\n\n");
// Check basic setup
$this->out("Checking basic setup...\n");
$installer->resetChecks();
if (!$this->runBasicChecks($installer)) {
$errorMessage = $this->extractErrors($installer->getChecks());
throw new RuntimeException($errorMessage);
}
$this->out(" Complete!\n\n");
// Check database connection
$this->out("Checking database...\n");
@ -178,37 +184,38 @@ HELP;
}
/**
* @param Installer $install the Installer instance
* @param Installer $installer the Installer instance
*
* @return bool true if checks were successfully, otherwise false
*/
private function runBasicChecks(Installer $install)
private function runBasicChecks(Installer $installer)
{
$checked = true;
$install->resetChecks();
if (!$install->checkFunctions()) {
$installer->resetChecks();
if (!$installer->checkFunctions()) {
$checked = false;
}
if (!$install->checkImagick()) {
if (!$installer->checkImagick()) {
$checked = false;
}
if (!$install->checkLocalIni()) {
if (!$installer->checkLocalIni()) {
$checked = false;
}
if (!$install->checkSmarty3()) {
if (!$installer->checkSmarty3()) {
$checked = false;
}
if ($install->checkKeys()) {
if (!$installer->checkKeys()) {
$checked = false;
}
$php_path = null;
if (!empty(Config::get('config', 'php_path'))) {
if (!$install->checkPHP(Config::get('config', 'php_path'), true)) {
throw new RuntimeException(" ERROR: The php_path is not valid in the config.\n");
}
} else {
throw new RuntimeException(" ERROR: The php_path is not set in the config.\n");
$php_path = Config::get('config', 'php_path');
}
if (!$installer->checkPHP($php_path, true)) {
$checked = false;
}
$this->out(" NOTICE: Not checking .htaccess/URL-Rewrite during CLI installation.\n");