X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FInstaller.php;h=8bdb00f0459131c222cc63804618a8f29285a9c2;hb=8f58d2d84eb510d8ed7e75ac8ab2a238bc199b12;hp=2df398fb0d0af6d4c6f64cca6a5ef069783bc118;hpb=58c9566c3d086583a1a55901c8c1c865d5f94891;p=friendica.git diff --git a/src/Core/Installer.php b/src/Core/Installer.php index 2df398fb0d..8bdb00f045 100644 --- a/src/Core/Installer.php +++ b/src/Core/Installer.php @@ -6,14 +6,11 @@ namespace Friendica\Core; use DOMDocument; use Exception; -use Friendica\Core\Config\Cache\IConfigCache; -use Friendica\Database\DBA; +use Friendica\Core\Config\Cache\ConfigCache; +use Friendica\Database\Database; use Friendica\Database\DBStructure; -use Friendica\Object\Image; -use Friendica\Util\Logger\VoidLogger; -use Friendica\Util\BasePath; +use Friendica\Util\Images; use Friendica\Util\Network; -use Friendica\Util\Profiler; use Friendica\Util\Strings; /** @@ -131,17 +128,15 @@ class Installer * - Creates `config/local.config.php` * - Installs Database Structure * - * @param IConfigCache $configCache The config cache with all config relevant information + * @param ConfigCache $configCache The config cache with all config relevant information * * @return bool true if the config was created, otherwise false * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function createConfig(IConfigCache $configCache) + public function createConfig(ConfigCache $configCache) { $basepath = $configCache->get('system', 'basepath'); - $url = $configCache->get('system', 'url'); - $tpl = Renderer::getMarkupTemplate('local.config.tpl'); $txt = Renderer::replaceMacros($tpl, [ '$dbhost' => $configCache->get('database', 'hostname'), @@ -154,12 +149,12 @@ class Installer '$hostname' => $configCache->get('config', 'hostname'), '$urlpath' => $configCache->get('system', 'urlpath'), - '$baseurl' => $url, + '$baseurl' => $configCache->get('system', 'url'), '$sslpolicy' => $configCache->get('system', 'ssl_policy'), '$basepath' => $basepath, '$timezone' => $configCache->get('system', 'default_timezone'), '$language' => $configCache->get('system', 'language'), - ], false); + ]); $result = file_put_contents($basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.config.php', $txt); @@ -574,7 +569,7 @@ class Installer if (class_exists('Imagick')) { $imagick = true; - $supported = Image::supportedTypes(); + $supported = Images::supportedTypes(); if (array_key_exists('image/gif', $supported)) { $gif = true; } @@ -595,31 +590,25 @@ class Installer /** * Checking the Database connection and if it is available for the current installation * - * @param IConfigCache $configCache The configuration cache - * @param Profiler $profiler The profiler of this app + * @param Database $dba * * @return bool true if the check was successful, otherwise false * @throws Exception */ - public function checkDB(IConfigCache $configCache, Profiler $profiler) + public function checkDB(Database $dba) { - $dbhost = $configCache->get('database', 'hostname'); - $dbuser = $configCache->get('database', 'username'); - $dbpass = $configCache->get('database', 'password'); - $dbdata = $configCache->get('database', 'database'); - - if (!DBA::connect($configCache, $profiler, new VoidLogger(), $dbhost, $dbuser, $dbpass, $dbdata)) { - $this->addCheck(L10n::t('Could not connect to database.'), false, true, ''); + $dba->reconnect(); - return false; - } - - if (DBA::connected()) { + if ($dba->isConnected()) { if (DBStructure::existsTable('user')) { $this->addCheck(L10n::t('Database already in use.'), false, true, ''); return false; } + } else { + $this->addCheck(L10n::t('Could not connect to database.'), false, true, ''); + + return false; } return true; @@ -628,12 +617,12 @@ class Installer /** * Setup the default cache for a new installation * - * @param IConfigCache $configCache The configuration cache + * @param ConfigCache $configCache The configuration cache * @param string $basePath The determined basepath * * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public function setUpCache(IConfigCache $configCache, $basePath) + public function setUpCache(ConfigCache $configCache, $basePath) { $configCache->set('config', 'php_path' , $this->getPHPPath()); $configCache->set('system', 'basepath' , $basePath);