]> git.mxchange.org Git - friendica.git/commitdiff
The config class now makes less database reads.
authorMichael <heluecht@pirati.ca>
Wed, 18 Jan 2017 21:45:32 +0000 (21:45 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 18 Jan 2017 21:45:32 +0000 (21:45 +0000)
29 files changed:
boot.php
database.sql
include/Core/Config.php
include/cli_startup.php
include/create_shadowentry.php
include/cron.php
include/cronhooks.php
include/cronjobs.php
include/dbclean.php
include/dbstructure.php
include/dbupdate.php
include/delivery.php
include/directory.php
include/discover_poco.php
include/expire.php
include/gprobe.php
include/notifier.php
include/onepoll.php
include/pubsubpublish.php
include/queue.php
include/remove_contact.php
include/shadowupdate.php
include/spool_post.php
include/tagupdate.php
include/threadupdate.php
include/update_gcontact.php
index.php
mod/friendica.php
util/maintenance.php

index d598ef8666f624634d23e7e3c58c97b91c761d0e..501ae38c429f7d79978c14408422c762e7b18e24 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -1569,7 +1569,7 @@ function update_db(App $a) {
                $stored = intval($build);
                $current = intval(DB_UPDATE_VERSION);
                if($stored < $current) {
-                       load_config('database');
+                       Config::load('database');
 
                        // We're reporting a different version than what is currently installed.
                        // Run any existing update scripts to bring the database up to current.
index a12f9d2046fe099223ab06074eb1cc76b55c6940..383253fcb1a17dab230187475bc2cf5323f99fa6 100644 (file)
@@ -9,13 +9,14 @@
 --
 CREATE TABLE IF NOT EXISTS `addon` (
        `id` int(11) NOT NULL auto_increment,
-       `name` varchar(255) NOT NULL DEFAULT '',
+       `name` varchar(190) NOT NULL DEFAULT '',
        `version` varchar(255) NOT NULL DEFAULT '',
        `installed` tinyint(1) NOT NULL DEFAULT 0,
        `hidden` tinyint(1) NOT NULL DEFAULT 0,
        `timestamp` bigint(20) NOT NULL DEFAULT 0,
        `plugin_admin` tinyint(1) NOT NULL DEFAULT 0,
-        PRIMARY KEY(`id`)
+        PRIMARY KEY(`id`),
+        UNIQUE INDEX `name` (`name`)
 ) DEFAULT CHARSET=utf8mb4;
 
 --
@@ -32,9 +33,9 @@ CREATE TABLE IF NOT EXISTS `attach` (
        `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
        `edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
        `allow_cid` mediumtext,
-       `allow_gid` medium_text,
-       `deny_cid` medium_text,
-       `deny_gid` medium_text,
+       `allow_gid` mediumtext,
+       `deny_cid` mediumtext,
+       `deny_gid` mediumtext,
         PRIMARY KEY(`id`)
 ) DEFAULT CHARSET=utf8mb4;
 
@@ -235,10 +236,10 @@ CREATE TABLE IF NOT EXISTS `event` (
        `nofinish` tinyint(1) NOT NULL DEFAULT 0,
        `adjust` tinyint(1) NOT NULL DEFAULT 1,
        `ignore` tinyint(1) unsigned NOT NULL DEFAULT 0,
-       `allow_cid` medium_text,
-       `allow_gid` medium_text,
-       `deny_cid` medium_text,
-       `deny_gid` medium_text,
+       `allow_cid` mediumtext,
+       `allow_gid` mediumtext,
+       `deny_cid` mediumtext,
+       `deny_gid` mediumtext,
         PRIMARY KEY(`id`),
         INDEX `uid_start` (`uid`,`start`)
 ) DEFAULT CHARSET=utf8mb4;
@@ -434,7 +435,7 @@ CREATE TABLE IF NOT EXISTS `hook` (
        `function` varchar(255) NOT NULL DEFAULT '',
        `priority` int(11) unsigned NOT NULL DEFAULT 0,
         PRIMARY KEY(`id`),
-        INDEX `hook_file_function` (`hook`(30),`file`(60),`function`(30))
+        UNIQUE INDEX `hook_file_function` (`hook`(50),`file`(80),`function`(60))
 ) DEFAULT CHARSET=utf8mb4;
 
 --
@@ -1073,10 +1074,10 @@ CREATE TABLE IF NOT EXISTS `user` (
        `expire_notification_sent` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
        `service_class` varchar(32) NOT NULL DEFAULT '',
        `def_gid` int(11) NOT NULL DEFAULT 0,
-       `allow_cid` medium_text,
-       `allow_gid` medium_text,
-       `deny_cid` medium_text,
-       `deny_gid` medium_text,
+       `allow_cid` mediumtext,
+       `allow_gid` mediumtext,
+       `deny_cid` mediumtext,
+       `deny_gid` mediumtext,
        `openidserver` text,
         PRIMARY KEY(`uid`),
         INDEX `nickname` (`nickname`(32))
index 7b7045a9ee3ed2f3fe00989d97db6cba13e9959f..574ff5b8a53c54fa00fd5b3f7bce3c5db0b965b8 100644 (file)
@@ -22,6 +22,8 @@ use dbm;
  */
 class Config {
 
+       private static $cache;
+
        /**
         * @brief Loads all configuration values of family into a cached storage.
         *
@@ -32,10 +34,17 @@ class Config {
         *  The category of the configuration value
         * @return void
         */
-       public static function load($family) {
+       public static function load($family = "config") {
+
+               // We don't preload "system" anymore.
+               // This reduces the number of database reads a lot.
+               if ($family == 'system') {
+                       return;
+               }
+
                $a = get_app();
 
-               $r = q("SELECT `v`, `k` FROM `config` WHERE `cat` = '%s' ORDER BY `cat`, `k`, `id`", dbesc($family));
+               $r = q("SELECT `v`, `k` FROM `config` WHERE `cat` = '%s'", dbesc($family));
                if (dbm::is_result($r)) {
                        foreach ($r as $rr) {
                                $k = $rr['k'];
@@ -43,11 +52,9 @@ class Config {
                                        $a->config[$k] = $rr['v'];
                                } else {
                                        $a->config[$family][$k] = $rr['v'];
+                                       self::$cache[$family][$k] = $rr['v'];
                                }
                        }
-               } else if ($family != 'config') {
-                       // Negative caching
-                       $a->config[$family] = "!<unset>!";
                }
        }
 
@@ -78,34 +85,38 @@ class Config {
                $a = get_app();
 
                if (!$refresh) {
-                       // Looking if the whole family isn't set
-                       if (isset($a->config[$family])) {
-                               if ($a->config[$family] === '!<unset>!') {
-                                       return $default_value;
-                               }
-                       }
 
-                       if (isset($a->config[$family][$key])) {
-                               if ($a->config[$family][$key] === '!<unset>!') {
+                       // Do we have the cached value? Then return it
+                       if (isset(self::$cache[$family][$key])) {
+                               if (self::$cache[$family][$key] == '!<unset>!') {
                                        return $default_value;
+                               } else {
+                                       return self::$cache[$family][$key];
                                }
-                               return $a->config[$family][$key];
                        }
                }
 
-               $ret = q("SELECT `v` FROM `config` WHERE `cat` = '%s' AND `k` = '%s' ORDER BY `id` DESC LIMIT 1",
+               $ret = q("SELECT `v` FROM `config` WHERE `cat` = '%s' AND `k` = '%s'",
                        dbesc($family),
                        dbesc($key)
                );
-               if (count($ret)) {
+               if (dbm::is_result($ret)) {
                        // manage array value
                        $val = (preg_match("|^a:[0-9]+:{.*}$|s", $ret[0]['v'])?unserialize( $ret[0]['v']):$ret[0]['v']);
-                       $a->config[$family][$key] = $val;
 
+                       // Assign the value from the database to the cache
+                       self::$cache[$family][$key] = $val;
                        return $val;
-               } else {
-                       $a->config[$family][$key] = '!<unset>!';
+               } elseif (isset($a->config[$family][$key])) {
+
+                       // Assign the value (mostly) from the .htconfig.php to the cache
+                       self::$cache[$family][$key] = $a->config[$family][$key];
+
+                       return $a->config[$family][$key];
                }
+
+               self::$cache[$family][$key] = '!<unset>!';
+
                return $default_value;
        }
 
@@ -134,7 +145,14 @@ class Config {
                        return true;
                }
 
-               $a->config[$family][$key] = $value;
+               if ($family === 'config') {
+                       $a->config[$key] = $value;
+               } elseif ($family != 'system') {
+                       $a->config[$family][$key] = $value;
+               }
+
+               // Assign the just added value to the cache
+               self::$cache[$family][$key] = $value;
 
                // manage array value
                $dbvalue = (is_array($value) ? serialize($value) : $value);
@@ -174,9 +192,8 @@ class Config {
         */
        public static function delete($family, $key) {
 
-               $a = get_app();
-               if (x($a->config[$family],$key)) {
-                       unset($a->config[$family][$key]);
+               if (isset(self::$cache[$family][$key])) {
+                       unset(self::$cache[$family][$key]);
                }
                $ret = q("DELETE FROM `config` WHERE `cat` = '%s' AND `k` = '%s'",
                        dbesc($family),
@@ -185,5 +202,4 @@ class Config {
 
                return $ret;
        }
-
 }
index 4cb86adef8db34d4673c79e32d52a76b4db3a617..4b66b47a0046921d9e3413cd04fd83552edd940b 100644 (file)
@@ -1,5 +1,7 @@
 <?php /** @file */
 
+use \Friendica\Core\Config;
+
 require_once('boot.php');
 
 // Everything we need to boot standalone 'background' processes
@@ -8,21 +10,20 @@ function cli_startup() {
 
        global $a, $db;
 
-       if(is_null($a)) {
+       if (is_null($a)) {
                $a = new App;
        }
 
-       if(is_null($db)) {
-           @include(".htconfig.php");
-       require_once("dba.php");
-           $db = new dba($db_host, $db_user, $db_pass, $db_data);
-       unset($db_host, $db_user, $db_pass, $db_data);
+       if (is_null($db)) {
+               @include(".htconfig.php");
+               require_once("dba.php");
+               $db = new dba($db_host, $db_user, $db_pass, $db_data);
+               unset($db_host, $db_user, $db_pass, $db_data);
        };
 
        require_once('include/session.php');
 
-       load_config('config');
-       load_config('system');
+       Config::load();
 
        $a->set_baseurl(get_config('system','url'));
 
index f06a0dd1bfb20640e0a32ad54418251514ab2ca7..005295c97898b261dc820b0f1ad36177c65440eb 100644 (file)
@@ -5,6 +5,9 @@
  *
  * This script is started from mod/item.php to save some time when doing a post.
  */
+
+use \Friendica\Core\Config;
+
 require_once("boot.php");
 require_once("include/threads.php");
 
@@ -21,8 +24,7 @@ function create_shadowentry_run($argv, $argc) {
                unset($db_host, $db_user, $db_pass, $db_data);
        }
 
-       load_config('config');
-       load_config('system');
+       Config::load();
 
        if ($argc != 2) {
                return;
index f7def61215c7f116edd920bf694311005c7d0c81..2fc8de51c5ebb25f61dde5820c67cc58ac6e9095 100644 (file)
@@ -10,6 +10,8 @@ if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) {
        chdir($directory);
 }
 
+use \Friendica\Core\Config;
+
 require_once("boot.php");
 require_once("include/photos.php");
 require_once("include/user.php");
@@ -38,8 +40,7 @@ function cron_run(&$argv, &$argc){
        require_once('mod/nodeinfo.php');
        require_once('include/post_update.php');
 
-       load_config('config');
-       load_config('system');
+       Config::load();
 
        // Don't check this stuff if the function is called by the poller
        if (App::callstack() != "poller_run") {
index 7524a0c3a8883c80b4a914e54093d7cfa9351508..72b86be427cc9f4dc034f5f64fb50aef5f4640a8 100644 (file)
@@ -1,7 +1,8 @@
 <?php
 
-require_once("boot.php");
+use \Friendica\Core\Config;
 
+require_once("boot.php");
 
 function cronhooks_run(&$argv, &$argc){
        global $a, $db;
@@ -20,8 +21,7 @@ function cronhooks_run(&$argv, &$argc){
        require_once('include/session.php');
        require_once('include/datetime.php');
 
-       load_config('config');
-       load_config('system');
+       Config::load();
 
        // Don't check this stuff if the function is called by the poller
        if (App::callstack() != "poller_run") {
index 1511efbe0da4da7de2a6eaecdbb054f39645f214..f0a56370b81566dca314f50ab8e3164533b93f7d 100644 (file)
@@ -1,4 +1,6 @@
 <?php
+use \Friendica\Core\Config;
+
 if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) {
        $directory = dirname($_SERVER["argv"][0]);
 
@@ -33,8 +35,7 @@ function cronjobs_run(&$argv, &$argc){
        require_once('include/post_update.php');
        require_once('mod/nodeinfo.php');
 
-       load_config('config');
-       load_config('system');
+       Config::load();
 
        $a->set_baseurl(get_config('system','url'));
 
index c80e5a3be357f2c26d997a0827d554b15f976fb7..8408ad1882fad73d9ed0df254d1caecf276b8809 100644 (file)
@@ -23,8 +23,7 @@ function dbclean_run(&$argv, &$argc) {
                unset($db_host, $db_user, $db_pass, $db_data);
        }
 
-       Config::load('config');
-       Config::load('system');
+       Config::load();
 
        if (!Config::get('system', 'dbclean', false)) {
                return;
index 283d39d22c25f63deb3378f9603f1ab664995e14..0fe157f329abab5282bacb8d052d380e827c765b 100644 (file)
@@ -495,7 +495,7 @@ function db_definition($charset) {
        $database["addon"] = array(
                        "fields" => array(
                                        "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
-                                       "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
+                                       "name" => array("type" => "varchar(190)", "not null" => "1", "default" => ""),
                                        "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
                                        "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
                                        "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
@@ -504,6 +504,7 @@ function db_definition($charset) {
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
+                                       "name" => array("UNIQUE", "name"),
                                        )
                        );
        $database["attach"] = array(
@@ -922,7 +923,7 @@ function db_definition($charset) {
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
-                                       "hook_file_function" => array("hook(30)","file(60)","function(30)"),
+                                       "hook_file_function" => array("UNIQUE", "hook(50)","file(80)","function(60)"),
                                        )
                        );
        $database["intro"] = array(
index 28f1de340b91ca5fb0b8c62d9ab56ca0af87ec49..3583be3106b57ea20137f30970823015acc8ee41 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use \Friendica\Core\Config;
+
 require_once("boot.php");
 
 function dbupdate_run(&$argv, &$argc) {
@@ -16,8 +18,7 @@ function dbupdate_run(&$argv, &$argc) {
                        unset($db_host, $db_user, $db_pass, $db_data);
        }
 
-       load_config('config');
-       load_config('system');
+       Config::load();
 
        update_db($a);
 }
index dd7535592f5e1fd46942f778b5d017ff86f4534e..5000a1edb908a77e9fbcc6053cbb8921c40ba4c2 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use \Friendica\Core\Config;
+
 require_once("boot.php");
 require_once('include/queue_fn.php');
 require_once('include/html2plain.php');
@@ -27,8 +30,7 @@ function delivery_run(&$argv, &$argc){
        require_once('include/bbcode.php');
        require_once('include/email.php');
 
-       load_config('config');
-       load_config('system');
+       Config::load();
 
        load_hooks();
 
index 85476bd5fdf498eaed07787c6c8e695732c2bd1f..2ca367d369442dc1a31bed67ad81cc1f64659a7e 100644 (file)
@@ -1,6 +1,8 @@
 <?php
 require_once("boot.php");
 
+use \Friendica\Core\Config;
+
 function directory_run(&$argv, &$argc){
        global $a, $db;
 
@@ -15,15 +17,11 @@ function directory_run(&$argv, &$argc){
                                unset($db_host, $db_user, $db_pass, $db_data);
        };
 
-       load_config('config');
-       load_config('system');
-
+       Config::load();
 
        if($argc != 2)
                return;
 
-       load_config('system');
-
        load_hooks();
 
 
index bf3e47edd9a514acde02b4dcb5cdcb8d00a676be..8146368784cb4691aef3711510eb8ebf59434a13 100644 (file)
@@ -1,9 +1,10 @@
 <?php
 
+use \Friendica\Core\Config;
+
 require_once("boot.php");
 require_once("include/socgraph.php");
 
-
 function discover_poco_run(&$argv, &$argc){
        global $a, $db;
 
@@ -21,8 +22,7 @@ function discover_poco_run(&$argv, &$argc){
        require_once('include/session.php');
        require_once('include/datetime.php');
 
-       load_config('config');
-       load_config('system');
+       Config::load();
 
        // Don't check this stuff if the function is called by the poller
        if (App::callstack() != "poller_run")
index e3313a78be9583ed7a5520ee1fb54987e363e814..855d7fb5e44abc544f7eb5f7f5364e7bd05253f6 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use \Friendica\Core\Config;
+
 require_once("boot.php");
 
 function expire_run(&$argv, &$argc){
@@ -10,19 +12,18 @@ function expire_run(&$argv, &$argc){
        }
 
        if(is_null($db)) {
-           @include(".htconfig.php");
-       require_once("include/dba.php");
-           $db = new dba($db_host, $db_user, $db_pass, $db_data);
-       unset($db_host, $db_user, $db_pass, $db_data);
-       };
+               @include(".htconfig.php");
+               require_once("include/dba.php");
+               $db = new dba($db_host, $db_user, $db_pass, $db_data);
+               unset($db_host, $db_user, $db_pass, $db_data);
+       };
 
        require_once('include/session.php');
        require_once('include/datetime.php');
        require_once('include/items.php');
        require_once('include/Contact.php');
 
-       load_config('config');
-       load_config('system');
+       Config::load();
 
        $a->set_baseurl(get_config('system','url'));
 
index 7169aada3f7e38435d194f770c62f8186794b9da..4407fa6d6c5ee77cba0dfcdb40c654a3ecd82c8b 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use \Friendica\Core\Config;
+
 require_once("boot.php");
 require_once('include/Scrape.php');
 require_once('include/socgraph.php');
@@ -21,8 +23,7 @@ function gprobe_run(&$argv, &$argc){
        require_once('include/session.php');
        require_once('include/datetime.php');
 
-       load_config('config');
-       load_config('system');
+       Config::load();
 
        $a->set_baseurl(get_config('system','url'));
 
index 7bea239c6f552c734fe44fbd7f019333dfeac260..24830a11ab336f20194ab96aa4580f65b8fd9ca3 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use \Friendica\Core\Config;
+
 require_once("boot.php");
 require_once('include/queue_fn.php');
 require_once('include/html2plain.php');
@@ -59,8 +62,8 @@ function notifier_run(&$argv, &$argc){
        require_once('include/items.php');
        require_once('include/bbcode.php');
        require_once('include/email.php');
-       load_config('config');
-       load_config('system');
+
+       Config::load();
 
        load_hooks();
 
index d92cb915b6eb0ce96801086699f40c01fa542866..5219d9f3bd5f291ec52c8fa8dd7e81814bf12fbb 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use \Friendica\Core\Config;
+
 require_once("boot.php");
 require_once("include/follow.php");
 
@@ -32,8 +34,7 @@ function onepoll_run(&$argv, &$argc){
        require_once('include/socgraph.php');
        require_once('include/queue_fn.php');
 
-       load_config('config');
-       load_config('system');
+       Config::load();
 
        $a->set_baseurl(get_config('system','url'));
 
index 6bd90bfc21e083704f561c00ae03a6a9d533a36d..428103a9713e5616f342a509d38f4cb1c016394d 100644 (file)
@@ -72,8 +72,7 @@ function pubsubpublish_run(&$argv, &$argc){
 
        require_once('include/items.php');
 
-       load_config('config');
-       load_config('system');
+       Config::load();
 
        // Don't check this stuff if the function is called by the poller
        if (App::callstack() != "poller_run") {
index f36e7723cd209b14978bcb40cadddfaaafafd3e2..bcd32985db890d2ea1d36f3e495e2a9278f66ea5 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use \Friendica\Core\Config;
+
 require_once("boot.php");
 require_once('include/queue_fn.php');
 require_once('include/dfrn.php');
@@ -23,8 +26,7 @@ function queue_run(&$argv, &$argc){
        require_once('include/bbcode.php');
        require_once('include/socgraph.php');
 
-       load_config('config');
-       load_config('system');
+       Config::load();
 
        // Don't check this stuff if the function is called by the poller
        if (App::callstack() != "poller_run")
index ec8b83eab933809261455d1ed65447072bf7b033..aa206211160ad1d14a13e38574cbe94c371adc29 100644 (file)
@@ -3,6 +3,9 @@
  * @file include/remove_contact.php
  * @brief Removes orphaned data from deleted contacts
  */
+
+use \Friendica\Core\Config;
+
 require_once("boot.php");
 
 function remove_contact_run($argv, $argc) {
@@ -19,8 +22,7 @@ function remove_contact_run($argv, $argc) {
                unset($db_host, $db_user, $db_pass, $db_data);
        }
 
-       load_config('config');
-       load_config('system');
+       Config::load();
 
        if ($argc != 2) {
                return;
index 74c2a43ebd792fc37cbe1d9c239e71690d53a31e..83a785fe1fdd88b3455685861354b27ad73d3594 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use \Friendica\Core\Config;
+
 require_once("boot.php");
 require_once("include/threads.php");
 
@@ -14,8 +17,7 @@ if(is_null($db)) {
        unset($db_host, $db_user, $db_pass, $db_data);
 }
 
-load_config('config');
-load_config('system');
+Config::load();
 
 update_shadow_copy();
 killme();
index c42928a67288c3783032852927c0ab54a59b3c4a..d55b100edae94bf7a72347a42a3df4dca3b660a6 100644 (file)
@@ -3,6 +3,9 @@
  * @file include/spool_post.php
  * @brief Posts items that wer spooled because they couldn't be posted.
  */
+
+use \Friendica\Core\Config;
+
 require_once("boot.php");
 require_once("include/items.php");
 
@@ -20,8 +23,7 @@ function spool_post_run($argv, $argc) {
                unset($db_host, $db_user, $db_pass, $db_data);
        }
 
-       load_config('config');
-       load_config('system');
+       Config::load();
 
        $path = get_spoolpath();
 
index b12e809772060b7287166c0d03dadcecf3eecf7d..b4de121e9f7c1bc08a2a87cd54f5c57f713a675b 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use \Friendica\Core\Config;
+
 require_once("boot.php");
 require_once("include/tags.php");
 
@@ -14,8 +17,7 @@ if(is_null($db)) {
        unset($db_host, $db_user, $db_pass, $db_data);
 }
 
-load_config('config');
-load_config('system');
+Config::load();
 
 update_items();
 killme();
index e9d9bf6e6b518d99683f52190e7b30e7c4de81ae..dc528c6b87105d1a34871508399df9dca14d603e 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+
+use \Friendica\Core\Config;
+
 require_once("boot.php");
 require_once("include/threads.php");
 
@@ -14,8 +17,7 @@ if(is_null($db)) {
        unset($db_host, $db_user, $db_pass, $db_data);
 }
 
-load_config('config');
-load_config('system');
+Config::load();
 
 update_threads();
 update_threads_mention();
index 88e1817f0b991ff6a0749c2d794b71510ab62b22..6aa8bcac29858e58127169e22f22388af50b2eb5 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use \Friendica\Core\Config;
+
 require_once("boot.php");
 
 function update_gcontact_run(&$argv, &$argc){
@@ -19,8 +21,7 @@ function update_gcontact_run(&$argv, &$argc){
        require_once('include/Scrape.php');
        require_once("include/socgraph.php");
 
-       load_config('config');
-       load_config('system');
+       Config::load();
 
        $a->set_baseurl(get_config('system','url'));
 
index f05151757b5466f8944299821cde706398e2ae11..7408f495cd202a67816303724692484afdb887af 100644 (file)
--- a/index.php
+++ b/index.php
@@ -13,6 +13,8 @@
  *
  */
 
+use \Friendica\Core\Config;
+
 require_once('boot.php');
 require_once('object/BaseObject.php');
 
@@ -54,8 +56,7 @@ if(!$install) {
         * Load configs from db. Overwrite configs from .htconfig.php
         */
 
-       load_config('config');
-       load_config('system');
+       Config::load();
 
        if ($a->max_processes_reached() OR $a->maxload_reached()) {
                header($_SERVER["SERVER_PROTOCOL"].' 503 Service Temporarily Unavailable');
index 3f242f7c56af6ce13ce34b64c9c0296d9093bf81..f613dfd39cef05e171db82c410fc75be35714507 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use \Friendica\Core\Config;
+
 function friendica_init(App $a) {
        if ($a->argv[1]=="json"){
                $register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN');
@@ -29,7 +31,7 @@ function friendica_init(App $a) {
                                        $visible_plugins[] = $rr['name'];
                }
 
-               load_config('feature_lock');
+               Config::load('feature_lock');
                $locked_features = array();
                if(is_array($a->config['feature_lock']) && count($a->config['feature_lock'])) {
                        foreach($a->config['feature_lock'] as $k => $v) {
index d1ff94524e83cca07912cac4b5c1f706b3b76029..28f3a503ad547f1e37f605ebc0b2e6e1a5b714a4 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use \Friendica\Core\Config;
+
 require_once("boot.php");
 
 $a = new App;
@@ -10,9 +12,9 @@ load_translation_table($lang);
 
 require_once("include/dba.php");
 $db = new dba($db_host, $db_user, $db_pass, $db_data, false);
-        unset($db_host, $db_user, $db_pass, $db_data);
-load_config('config');
-load_config('system');
+unset($db_host, $db_user, $db_pass, $db_data);
+
+Config::load();
 
 $maint_mode = 1;
 if($argc > 1)