]> git.mxchange.org Git - friendica.git/blobdiff - src/Factory/DBFactory.php
Forums now are working with AP as well
[friendica.git] / src / Factory / DBFactory.php
index 5970541c105d19eb544cd11c5e01816f63c96c0f..b4f0c9e3c194eb11f664df918c3654a04e96f366 100644 (file)
@@ -4,10 +4,23 @@ namespace Friendica\Factory;
 
 use Friendica\Core\Config\Cache;
 use Friendica\Database;
+use Friendica\Util\Profiler;
 
 class DBFactory
 {
-       public static function init(Cache\ConfigCache $configCache, array $server)
+       /**
+        * Initialize the DBA connection
+        *
+        * @param string             $basePath    The basepath of the application
+        * @param Cache\IConfigCache $configCache The configuration cache
+        * @param Profiler           $profiler    The profiler
+        * @param array              $server      The $_SERVER variables
+        *
+        * @throws \Exception if connection went bad
+        *
+        * @todo refactor basedir during https://github.com/friendica/friendica/issues/6720
+        */
+       public static function init($basePath, Cache\IConfigCache $configCache, Profiler $profiler, array $server)
        {
                if (Database\DBA::connected()) {
                        return;
@@ -38,9 +51,9 @@ class DBFactory
                        $db_data = $server['MYSQL_DATABASE'];
                }
 
-               if (Database\DBA::connect($configCache, $db_host, $db_user, $db_pass, $db_data, $charset)) {
+               if (Database\DBA::connect($basePath, $configCache, $profiler, $db_host, $db_user, $db_pass, $db_data, $charset)) {
                        // Loads DB_UPDATE_VERSION constant
-                       Database\DBStructure::definition($configCache->get('system', 'basepath'), false);
+                       Database\DBStructure::definition($basePath, false);
                }
 
                unset($db_host, $db_user, $db_pass, $db_data, $charset);