X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FConsole%2FAutomaticInstallation.php;h=43c79bfb5712d5c3847c2537ba8e11615d20c05f;hb=af6dbc654f82225cfc647fe2072662acae388e47;hp=6318b19a88279be8c8db5c4845a8e9a2f3af992a;hpb=c66c09d5fd86e74ac6f1b877143e8cf55e3a0340;p=friendica.git diff --git a/src/Core/Console/AutomaticInstallation.php b/src/Core/Console/AutomaticInstallation.php index 6318b19a88..43c79bfb57 100644 --- a/src/Core/Console/AutomaticInstallation.php +++ b/src/Core/Console/AutomaticInstallation.php @@ -3,8 +3,12 @@ namespace Friendica\Core\Console; use Asika\SimpleConsole\Console; -use dba; use Friendica\App; +use Friendica\Core\Config; +use Friendica\Core\Install; +use Friendica\Core\Theme; +use Friendica\Database\DBA; +use RuntimeException; require_once 'mod/install.php'; require_once 'include/dba.php'; @@ -16,8 +20,8 @@ class AutomaticInstallation extends Console return <<getOption('f', 'htconfig.php'); + + $this->out("Using config $config_file...\n"); + require_once $config_file; + + Install::setInstallMode(); $this->out(" Complete!\n\n"); @@ -53,7 +64,7 @@ HELP; $errorMessage = $this->extractErrors($checkResults['basic']); if ($errorMessage !== '') { - throw new \RuntimeException($errorMessage); + throw new RuntimeException($errorMessage); } $this->out(" Complete!\n\n"); @@ -66,7 +77,7 @@ HELP; $errorMessage = $this->extractErrors($checkResults['db']); if ($errorMessage !== '') { - throw new \RuntimeException($errorMessage); + throw new RuntimeException($errorMessage); } $this->out(" Complete!\n\n"); @@ -74,18 +85,27 @@ HELP; // Install database $this->out("Inserting data into database...\n"); - $checkResults['data'] = load_database(); + $checkResults['data'] = Install::installDatabaseStructure(); if ($checkResults['data'] !== '') { - throw new \RuntimeException("ERROR: DB Database creation error. Is the DB empty?\n"); + throw new RuntimeException("ERROR: DB Database creation error. Is the DB empty?\n"); } $this->out(" Complete!\n\n"); + // Install theme + $this->out("Installing theme\n"); + if (!empty(Config::get('system', 'theme'))) { + Theme::install(Config::get('system', 'theme')); + $this->out(" Complete\n\n"); + } else { + $this->out(" Theme setting is empty. Please check the file htconfig.php\n\n"); + } + // Copy config file $this->out("Saving config file...\n"); - if (!copy('htconfig.php', '.htconfig.php')) { - throw new \RuntimeException("ERROR: Saving config file failed. Please copy .htautoinstall.php to .htconfig.php manually.\n"); + if ($config_file != '.htconfig.php' && !copy($config_file, '.htconfig.php')) { + throw new RuntimeException("ERROR: Saving config file failed. Please copy '$config_file' to '.htconfig.php' manually.\n"); } $this->out(" Complete!\n\n"); $this->out("\nInstallation is finished\n"); @@ -101,16 +121,16 @@ HELP; { $checks = []; - check_funcs($checks); - check_imagik($checks); - check_htconfig($checks); - check_smarty3($checks); - check_keys($checks); + Install::checkFunctions($checks); + Install::checkImagick($checks); + Install::checkLocalIni($checks); + Install::checkSmarty3($checks); + Install::checkKeys($checks); - if (!empty($app->config['php_path'])) { - check_php($app->config['php_path'], $checks); + if (!empty(Config::get('config', 'php_path'))) { + Install::checkPHP(Config::get('config', 'php_path'), $checks); } else { - throw new \RuntimeException(" ERROR: The php_path is not set in the config. Please check the file .htconfig.php.\n"); + throw new RuntimeException(" ERROR: The php_path is not set in the config.\n"); } $this->out(" NOTICE: Not checking .htaccess/URL-Rewrite during CLI installation.\n"); @@ -135,7 +155,7 @@ HELP; ); - if (!dba::connect($db_host, $db_user, $db_pass, $db_data, true)) { + if (!DBA::connect($db_host, $db_user, $db_pass, $db_data)) { $result['status'] = false; $result['help'] = 'Failed, please check your MySQL settings and credentials.'; }