]> git.mxchange.org Git - friendica.git/commitdiff
Bugfixing DB/Installer
authorPhilipp Holzer <admin+github@philipp.info>
Tue, 9 Jul 2019 20:20:39 +0000 (22:20 +0200)
committerPhilipp Holzer <admin+github@philipp.info>
Tue, 9 Jul 2019 20:22:06 +0000 (22:22 +0200)
- default value with HiddenString
- Fixing checkDB during installation

config/defaults.config.php
src/Core/Installer.php

index b4471af25caf81b1bf437dbf31637bafd83f1fe8..fac08e9843c133d5ab3de2871013cab4353a2f3c 100644 (file)
@@ -22,7 +22,7 @@ return [
 
                // pass (String)
                // Database user password. Please don't use empty passwords.
-               'password' => '',
+               'password' => new \ParagonIE\HiddenString\HiddenString(''),
 
                // base (String)
                // Database name.
index 046b34ea6f7e3e87d495e7ff23908d4b848c5ca6..f49dde4e560adf9f136941e1fedf33287a80d93b 100644 (file)
@@ -7,8 +7,8 @@ namespace Friendica\Core;
 use DOMDocument;
 use Exception;
 use Friendica\Core\Config\Cache\IConfigCache;
-use Friendica\Database\DBA;
 use Friendica\Database\DBStructure;
+use Friendica\Factory\DBFactory;
 use Friendica\Object\Image;
 use Friendica\Util\Logger\VoidLogger;
 use Friendica\Util\Network;
@@ -600,23 +600,18 @@ class Installer
         */
        public function checkDB(IConfigCache $configCache, Profiler $profiler)
        {
-               $dbhost = $configCache->get('database', 'hostname');
-               $dbuser = $configCache->get('database', 'username');
-               $dbpass = $configCache->get('database', 'password');
-               $dbdata = $configCache->get('database', 'database');
+               $database = DBFactory::init($configCache, $profiler, [], new VoidLogger());
 
-               if (!DBA::connect($configCache, $profiler, new VoidLogger(), $dbhost, $dbuser, $dbpass, $dbdata)) {
-                       $this->addCheck(L10n::t('Could not connect to database.'), false, true, '');
-
-                       return false;
-               }
-
-               if (DBA::connected()) {
+               if ($database->connected()) {
                        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;