mirror of
https://github.com/friendica/friendica
synced 2024-12-23 03:20:15 +00:00
The config class now makes less database reads.
This commit is contained in:
parent
045e94ccf3
commit
0548099f6c
29 changed files with 153 additions and 107 deletions
2
boot.php
2
boot.php
|
@ -1569,7 +1569,7 @@ function update_db(App $a) {
|
||||||
$stored = intval($build);
|
$stored = intval($build);
|
||||||
$current = intval(DB_UPDATE_VERSION);
|
$current = intval(DB_UPDATE_VERSION);
|
||||||
if($stored < $current) {
|
if($stored < $current) {
|
||||||
load_config('database');
|
Config::load('database');
|
||||||
|
|
||||||
// We're reporting a different version than what is currently installed.
|
// We're reporting a different version than what is currently installed.
|
||||||
// Run any existing update scripts to bring the database up to current.
|
// Run any existing update scripts to bring the database up to current.
|
||||||
|
|
29
database.sql
29
database.sql
|
@ -9,13 +9,14 @@
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS `addon` (
|
CREATE TABLE IF NOT EXISTS `addon` (
|
||||||
`id` int(11) NOT NULL auto_increment,
|
`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 '',
|
`version` varchar(255) NOT NULL DEFAULT '',
|
||||||
`installed` tinyint(1) NOT NULL DEFAULT 0,
|
`installed` tinyint(1) NOT NULL DEFAULT 0,
|
||||||
`hidden` tinyint(1) NOT NULL DEFAULT 0,
|
`hidden` tinyint(1) NOT NULL DEFAULT 0,
|
||||||
`timestamp` bigint(20) NOT NULL DEFAULT 0,
|
`timestamp` bigint(20) NOT NULL DEFAULT 0,
|
||||||
`plugin_admin` tinyint(1) 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;
|
) DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@ -32,9 +33,9 @@ CREATE TABLE IF NOT EXISTS `attach` (
|
||||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
`edited` 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_cid` mediumtext,
|
||||||
`allow_gid` medium_text,
|
`allow_gid` mediumtext,
|
||||||
`deny_cid` medium_text,
|
`deny_cid` mediumtext,
|
||||||
`deny_gid` medium_text,
|
`deny_gid` mediumtext,
|
||||||
PRIMARY KEY(`id`)
|
PRIMARY KEY(`id`)
|
||||||
) DEFAULT CHARSET=utf8mb4;
|
) DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
@ -235,10 +236,10 @@ CREATE TABLE IF NOT EXISTS `event` (
|
||||||
`nofinish` tinyint(1) NOT NULL DEFAULT 0,
|
`nofinish` tinyint(1) NOT NULL DEFAULT 0,
|
||||||
`adjust` tinyint(1) NOT NULL DEFAULT 1,
|
`adjust` tinyint(1) NOT NULL DEFAULT 1,
|
||||||
`ignore` tinyint(1) unsigned NOT NULL DEFAULT 0,
|
`ignore` tinyint(1) unsigned NOT NULL DEFAULT 0,
|
||||||
`allow_cid` medium_text,
|
`allow_cid` mediumtext,
|
||||||
`allow_gid` medium_text,
|
`allow_gid` mediumtext,
|
||||||
`deny_cid` medium_text,
|
`deny_cid` mediumtext,
|
||||||
`deny_gid` medium_text,
|
`deny_gid` mediumtext,
|
||||||
PRIMARY KEY(`id`),
|
PRIMARY KEY(`id`),
|
||||||
INDEX `uid_start` (`uid`,`start`)
|
INDEX `uid_start` (`uid`,`start`)
|
||||||
) DEFAULT CHARSET=utf8mb4;
|
) DEFAULT CHARSET=utf8mb4;
|
||||||
|
@ -434,7 +435,7 @@ CREATE TABLE IF NOT EXISTS `hook` (
|
||||||
`function` varchar(255) NOT NULL DEFAULT '',
|
`function` varchar(255) NOT NULL DEFAULT '',
|
||||||
`priority` int(11) unsigned NOT NULL DEFAULT 0,
|
`priority` int(11) unsigned NOT NULL DEFAULT 0,
|
||||||
PRIMARY KEY(`id`),
|
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;
|
) 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',
|
`expire_notification_sent` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
`service_class` varchar(32) NOT NULL DEFAULT '',
|
`service_class` varchar(32) NOT NULL DEFAULT '',
|
||||||
`def_gid` int(11) NOT NULL DEFAULT 0,
|
`def_gid` int(11) NOT NULL DEFAULT 0,
|
||||||
`allow_cid` medium_text,
|
`allow_cid` mediumtext,
|
||||||
`allow_gid` medium_text,
|
`allow_gid` mediumtext,
|
||||||
`deny_cid` medium_text,
|
`deny_cid` mediumtext,
|
||||||
`deny_gid` medium_text,
|
`deny_gid` mediumtext,
|
||||||
`openidserver` text,
|
`openidserver` text,
|
||||||
PRIMARY KEY(`uid`),
|
PRIMARY KEY(`uid`),
|
||||||
INDEX `nickname` (`nickname`(32))
|
INDEX `nickname` (`nickname`(32))
|
||||||
|
|
|
@ -22,6 +22,8 @@ use dbm;
|
||||||
*/
|
*/
|
||||||
class Config {
|
class Config {
|
||||||
|
|
||||||
|
private static $cache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Loads all configuration values of family into a cached storage.
|
* @brief Loads all configuration values of family into a cached storage.
|
||||||
*
|
*
|
||||||
|
@ -32,10 +34,17 @@ class Config {
|
||||||
* The category of the configuration value
|
* The category of the configuration value
|
||||||
* @return void
|
* @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();
|
$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)) {
|
if (dbm::is_result($r)) {
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
$k = $rr['k'];
|
$k = $rr['k'];
|
||||||
|
@ -43,11 +52,9 @@ class Config {
|
||||||
$a->config[$k] = $rr['v'];
|
$a->config[$k] = $rr['v'];
|
||||||
} else {
|
} else {
|
||||||
$a->config[$family][$k] = $rr['v'];
|
$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();
|
$a = get_app();
|
||||||
|
|
||||||
if (!$refresh) {
|
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])) {
|
// Do we have the cached value? Then return it
|
||||||
if ($a->config[$family][$key] === '!<unset>!') {
|
if (isset(self::$cache[$family][$key])) {
|
||||||
|
if (self::$cache[$family][$key] == '!<unset>!') {
|
||||||
return $default_value;
|
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($family),
|
||||||
dbesc($key)
|
dbesc($key)
|
||||||
);
|
);
|
||||||
if (count($ret)) {
|
if (dbm::is_result($ret)) {
|
||||||
// manage array value
|
// manage array value
|
||||||
$val = (preg_match("|^a:[0-9]+:{.*}$|s", $ret[0]['v'])?unserialize( $ret[0]['v']):$ret[0]['v']);
|
$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;
|
return $val;
|
||||||
} else {
|
} elseif (isset($a->config[$family][$key])) {
|
||||||
$a->config[$family][$key] = '!<unset>!';
|
|
||||||
|
// 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;
|
return $default_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +145,14 @@ class Config {
|
||||||
return true;
|
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
|
// manage array value
|
||||||
$dbvalue = (is_array($value) ? serialize($value) : $value);
|
$dbvalue = (is_array($value) ? serialize($value) : $value);
|
||||||
|
@ -174,9 +192,8 @@ class Config {
|
||||||
*/
|
*/
|
||||||
public static function delete($family, $key) {
|
public static function delete($family, $key) {
|
||||||
|
|
||||||
$a = get_app();
|
if (isset(self::$cache[$family][$key])) {
|
||||||
if (x($a->config[$family],$key)) {
|
unset(self::$cache[$family][$key]);
|
||||||
unset($a->config[$family][$key]);
|
|
||||||
}
|
}
|
||||||
$ret = q("DELETE FROM `config` WHERE `cat` = '%s' AND `k` = '%s'",
|
$ret = q("DELETE FROM `config` WHERE `cat` = '%s' AND `k` = '%s'",
|
||||||
dbesc($family),
|
dbesc($family),
|
||||||
|
@ -185,5 +202,4 @@ class Config {
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php /** @file */
|
<?php /** @file */
|
||||||
|
|
||||||
|
use \Friendica\Core\Config;
|
||||||
|
|
||||||
require_once('boot.php');
|
require_once('boot.php');
|
||||||
|
|
||||||
// Everything we need to boot standalone 'background' processes
|
// Everything we need to boot standalone 'background' processes
|
||||||
|
@ -8,21 +10,20 @@ function cli_startup() {
|
||||||
|
|
||||||
global $a, $db;
|
global $a, $db;
|
||||||
|
|
||||||
if(is_null($a)) {
|
if (is_null($a)) {
|
||||||
$a = new App;
|
$a = new App;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_null($db)) {
|
if (is_null($db)) {
|
||||||
@include(".htconfig.php");
|
@include(".htconfig.php");
|
||||||
require_once("dba.php");
|
require_once("dba.php");
|
||||||
$db = new dba($db_host, $db_user, $db_pass, $db_data);
|
$db = new dba($db_host, $db_user, $db_pass, $db_data);
|
||||||
unset($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/session.php');
|
||||||
|
|
||||||
load_config('config');
|
Config::load();
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
$a->set_baseurl(get_config('system','url'));
|
$a->set_baseurl(get_config('system','url'));
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
*
|
*
|
||||||
* This script is started from mod/item.php to save some time when doing a post.
|
* 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("boot.php");
|
||||||
require_once("include/threads.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);
|
unset($db_host, $db_user, $db_pass, $db_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
load_config('config');
|
Config::load();
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
if ($argc != 2) {
|
if ($argc != 2) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -10,6 +10,8 @@ if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) {
|
||||||
chdir($directory);
|
chdir($directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use \Friendica\Core\Config;
|
||||||
|
|
||||||
require_once("boot.php");
|
require_once("boot.php");
|
||||||
require_once("include/photos.php");
|
require_once("include/photos.php");
|
||||||
require_once("include/user.php");
|
require_once("include/user.php");
|
||||||
|
@ -38,8 +40,7 @@ function cron_run(&$argv, &$argc){
|
||||||
require_once('mod/nodeinfo.php');
|
require_once('mod/nodeinfo.php');
|
||||||
require_once('include/post_update.php');
|
require_once('include/post_update.php');
|
||||||
|
|
||||||
load_config('config');
|
Config::load();
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
// Don't check this stuff if the function is called by the poller
|
// Don't check this stuff if the function is called by the poller
|
||||||
if (App::callstack() != "poller_run") {
|
if (App::callstack() != "poller_run") {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once("boot.php");
|
use \Friendica\Core\Config;
|
||||||
|
|
||||||
|
require_once("boot.php");
|
||||||
|
|
||||||
function cronhooks_run(&$argv, &$argc){
|
function cronhooks_run(&$argv, &$argc){
|
||||||
global $a, $db;
|
global $a, $db;
|
||||||
|
@ -20,8 +21,7 @@ function cronhooks_run(&$argv, &$argc){
|
||||||
require_once('include/session.php');
|
require_once('include/session.php');
|
||||||
require_once('include/datetime.php');
|
require_once('include/datetime.php');
|
||||||
|
|
||||||
load_config('config');
|
Config::load();
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
// Don't check this stuff if the function is called by the poller
|
// Don't check this stuff if the function is called by the poller
|
||||||
if (App::callstack() != "poller_run") {
|
if (App::callstack() != "poller_run") {
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
use \Friendica\Core\Config;
|
||||||
|
|
||||||
if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) {
|
if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) {
|
||||||
$directory = dirname($_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('include/post_update.php');
|
||||||
require_once('mod/nodeinfo.php');
|
require_once('mod/nodeinfo.php');
|
||||||
|
|
||||||
load_config('config');
|
Config::load();
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
$a->set_baseurl(get_config('system','url'));
|
$a->set_baseurl(get_config('system','url'));
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,7 @@ function dbclean_run(&$argv, &$argc) {
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
unset($db_host, $db_user, $db_pass, $db_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
Config::load('config');
|
Config::load();
|
||||||
Config::load('system');
|
|
||||||
|
|
||||||
if (!Config::get('system', 'dbclean', false)) {
|
if (!Config::get('system', 'dbclean', false)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -495,7 +495,7 @@ function db_definition($charset) {
|
||||||
$database["addon"] = array(
|
$database["addon"] = array(
|
||||||
"fields" => array(
|
"fields" => array(
|
||||||
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
|
"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" => ""),
|
"version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||||
"installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
"installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||||
"hidden" => 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(
|
"indexes" => array(
|
||||||
"PRIMARY" => array("id"),
|
"PRIMARY" => array("id"),
|
||||||
|
"name" => array("UNIQUE", "name"),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$database["attach"] = array(
|
$database["attach"] = array(
|
||||||
|
@ -922,7 +923,7 @@ function db_definition($charset) {
|
||||||
),
|
),
|
||||||
"indexes" => array(
|
"indexes" => array(
|
||||||
"PRIMARY" => array("id"),
|
"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(
|
$database["intro"] = array(
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use \Friendica\Core\Config;
|
||||||
|
|
||||||
require_once("boot.php");
|
require_once("boot.php");
|
||||||
|
|
||||||
function dbupdate_run(&$argv, &$argc) {
|
function dbupdate_run(&$argv, &$argc) {
|
||||||
|
@ -16,8 +18,7 @@ function dbupdate_run(&$argv, &$argc) {
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
unset($db_host, $db_user, $db_pass, $db_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
load_config('config');
|
Config::load();
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
update_db($a);
|
update_db($a);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use \Friendica\Core\Config;
|
||||||
|
|
||||||
require_once("boot.php");
|
require_once("boot.php");
|
||||||
require_once('include/queue_fn.php');
|
require_once('include/queue_fn.php');
|
||||||
require_once('include/html2plain.php');
|
require_once('include/html2plain.php');
|
||||||
|
@ -27,8 +30,7 @@ function delivery_run(&$argv, &$argc){
|
||||||
require_once('include/bbcode.php');
|
require_once('include/bbcode.php');
|
||||||
require_once('include/email.php');
|
require_once('include/email.php');
|
||||||
|
|
||||||
load_config('config');
|
Config::load();
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
load_hooks();
|
load_hooks();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
require_once("boot.php");
|
require_once("boot.php");
|
||||||
|
|
||||||
|
use \Friendica\Core\Config;
|
||||||
|
|
||||||
function directory_run(&$argv, &$argc){
|
function directory_run(&$argv, &$argc){
|
||||||
global $a, $db;
|
global $a, $db;
|
||||||
|
|
||||||
|
@ -15,15 +17,11 @@ function directory_run(&$argv, &$argc){
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
unset($db_host, $db_user, $db_pass, $db_data);
|
||||||
};
|
};
|
||||||
|
|
||||||
load_config('config');
|
Config::load();
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
|
|
||||||
if($argc != 2)
|
if($argc != 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
load_hooks();
|
load_hooks();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use \Friendica\Core\Config;
|
||||||
|
|
||||||
require_once("boot.php");
|
require_once("boot.php");
|
||||||
require_once("include/socgraph.php");
|
require_once("include/socgraph.php");
|
||||||
|
|
||||||
|
|
||||||
function discover_poco_run(&$argv, &$argc){
|
function discover_poco_run(&$argv, &$argc){
|
||||||
global $a, $db;
|
global $a, $db;
|
||||||
|
|
||||||
|
@ -21,8 +22,7 @@ function discover_poco_run(&$argv, &$argc){
|
||||||
require_once('include/session.php');
|
require_once('include/session.php');
|
||||||
require_once('include/datetime.php');
|
require_once('include/datetime.php');
|
||||||
|
|
||||||
load_config('config');
|
Config::load();
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
// Don't check this stuff if the function is called by the poller
|
// Don't check this stuff if the function is called by the poller
|
||||||
if (App::callstack() != "poller_run")
|
if (App::callstack() != "poller_run")
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use \Friendica\Core\Config;
|
||||||
|
|
||||||
require_once("boot.php");
|
require_once("boot.php");
|
||||||
|
|
||||||
function expire_run(&$argv, &$argc){
|
function expire_run(&$argv, &$argc){
|
||||||
|
@ -10,19 +12,18 @@ function expire_run(&$argv, &$argc){
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_null($db)) {
|
if(is_null($db)) {
|
||||||
@include(".htconfig.php");
|
@include(".htconfig.php");
|
||||||
require_once("include/dba.php");
|
require_once("include/dba.php");
|
||||||
$db = new dba($db_host, $db_user, $db_pass, $db_data);
|
$db = new dba($db_host, $db_user, $db_pass, $db_data);
|
||||||
unset($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/session.php');
|
||||||
require_once('include/datetime.php');
|
require_once('include/datetime.php');
|
||||||
require_once('include/items.php');
|
require_once('include/items.php');
|
||||||
require_once('include/Contact.php');
|
require_once('include/Contact.php');
|
||||||
|
|
||||||
load_config('config');
|
Config::load();
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
$a->set_baseurl(get_config('system','url'));
|
$a->set_baseurl(get_config('system','url'));
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use \Friendica\Core\Config;
|
||||||
|
|
||||||
require_once("boot.php");
|
require_once("boot.php");
|
||||||
require_once('include/Scrape.php');
|
require_once('include/Scrape.php');
|
||||||
require_once('include/socgraph.php');
|
require_once('include/socgraph.php');
|
||||||
|
@ -21,8 +23,7 @@ function gprobe_run(&$argv, &$argc){
|
||||||
require_once('include/session.php');
|
require_once('include/session.php');
|
||||||
require_once('include/datetime.php');
|
require_once('include/datetime.php');
|
||||||
|
|
||||||
load_config('config');
|
Config::load();
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
$a->set_baseurl(get_config('system','url'));
|
$a->set_baseurl(get_config('system','url'));
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use \Friendica\Core\Config;
|
||||||
|
|
||||||
require_once("boot.php");
|
require_once("boot.php");
|
||||||
require_once('include/queue_fn.php');
|
require_once('include/queue_fn.php');
|
||||||
require_once('include/html2plain.php');
|
require_once('include/html2plain.php');
|
||||||
|
@ -59,8 +62,8 @@ function notifier_run(&$argv, &$argc){
|
||||||
require_once('include/items.php');
|
require_once('include/items.php');
|
||||||
require_once('include/bbcode.php');
|
require_once('include/bbcode.php');
|
||||||
require_once('include/email.php');
|
require_once('include/email.php');
|
||||||
load_config('config');
|
|
||||||
load_config('system');
|
Config::load();
|
||||||
|
|
||||||
load_hooks();
|
load_hooks();
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use \Friendica\Core\Config;
|
||||||
|
|
||||||
require_once("boot.php");
|
require_once("boot.php");
|
||||||
require_once("include/follow.php");
|
require_once("include/follow.php");
|
||||||
|
|
||||||
|
@ -32,8 +34,7 @@ function onepoll_run(&$argv, &$argc){
|
||||||
require_once('include/socgraph.php');
|
require_once('include/socgraph.php');
|
||||||
require_once('include/queue_fn.php');
|
require_once('include/queue_fn.php');
|
||||||
|
|
||||||
load_config('config');
|
Config::load();
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
$a->set_baseurl(get_config('system','url'));
|
$a->set_baseurl(get_config('system','url'));
|
||||||
|
|
||||||
|
|
|
@ -72,8 +72,7 @@ function pubsubpublish_run(&$argv, &$argc){
|
||||||
|
|
||||||
require_once('include/items.php');
|
require_once('include/items.php');
|
||||||
|
|
||||||
load_config('config');
|
Config::load();
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
// Don't check this stuff if the function is called by the poller
|
// Don't check this stuff if the function is called by the poller
|
||||||
if (App::callstack() != "poller_run") {
|
if (App::callstack() != "poller_run") {
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use \Friendica\Core\Config;
|
||||||
|
|
||||||
require_once("boot.php");
|
require_once("boot.php");
|
||||||
require_once('include/queue_fn.php');
|
require_once('include/queue_fn.php');
|
||||||
require_once('include/dfrn.php');
|
require_once('include/dfrn.php');
|
||||||
|
@ -23,8 +26,7 @@ function queue_run(&$argv, &$argc){
|
||||||
require_once('include/bbcode.php');
|
require_once('include/bbcode.php');
|
||||||
require_once('include/socgraph.php');
|
require_once('include/socgraph.php');
|
||||||
|
|
||||||
load_config('config');
|
Config::load();
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
// Don't check this stuff if the function is called by the poller
|
// Don't check this stuff if the function is called by the poller
|
||||||
if (App::callstack() != "poller_run")
|
if (App::callstack() != "poller_run")
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
* @file include/remove_contact.php
|
* @file include/remove_contact.php
|
||||||
* @brief Removes orphaned data from deleted contacts
|
* @brief Removes orphaned data from deleted contacts
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use \Friendica\Core\Config;
|
||||||
|
|
||||||
require_once("boot.php");
|
require_once("boot.php");
|
||||||
|
|
||||||
function remove_contact_run($argv, $argc) {
|
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);
|
unset($db_host, $db_user, $db_pass, $db_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
load_config('config');
|
Config::load();
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
if ($argc != 2) {
|
if ($argc != 2) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use \Friendica\Core\Config;
|
||||||
|
|
||||||
require_once("boot.php");
|
require_once("boot.php");
|
||||||
require_once("include/threads.php");
|
require_once("include/threads.php");
|
||||||
|
|
||||||
|
@ -14,8 +17,7 @@ if(is_null($db)) {
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
unset($db_host, $db_user, $db_pass, $db_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
load_config('config');
|
Config::load();
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
update_shadow_copy();
|
update_shadow_copy();
|
||||||
killme();
|
killme();
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
* @file include/spool_post.php
|
* @file include/spool_post.php
|
||||||
* @brief Posts items that wer spooled because they couldn't be posted.
|
* @brief Posts items that wer spooled because they couldn't be posted.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use \Friendica\Core\Config;
|
||||||
|
|
||||||
require_once("boot.php");
|
require_once("boot.php");
|
||||||
require_once("include/items.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);
|
unset($db_host, $db_user, $db_pass, $db_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
load_config('config');
|
Config::load();
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
$path = get_spoolpath();
|
$path = get_spoolpath();
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use \Friendica\Core\Config;
|
||||||
|
|
||||||
require_once("boot.php");
|
require_once("boot.php");
|
||||||
require_once("include/tags.php");
|
require_once("include/tags.php");
|
||||||
|
|
||||||
|
@ -14,8 +17,7 @@ if(is_null($db)) {
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
unset($db_host, $db_user, $db_pass, $db_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
load_config('config');
|
Config::load();
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
update_items();
|
update_items();
|
||||||
killme();
|
killme();
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use \Friendica\Core\Config;
|
||||||
|
|
||||||
require_once("boot.php");
|
require_once("boot.php");
|
||||||
require_once("include/threads.php");
|
require_once("include/threads.php");
|
||||||
|
|
||||||
|
@ -14,8 +17,7 @@ if(is_null($db)) {
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
unset($db_host, $db_user, $db_pass, $db_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
load_config('config');
|
Config::load();
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
update_threads();
|
update_threads();
|
||||||
update_threads_mention();
|
update_threads_mention();
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use \Friendica\Core\Config;
|
||||||
|
|
||||||
require_once("boot.php");
|
require_once("boot.php");
|
||||||
|
|
||||||
function update_gcontact_run(&$argv, &$argc){
|
function update_gcontact_run(&$argv, &$argc){
|
||||||
|
@ -19,8 +21,7 @@ function update_gcontact_run(&$argv, &$argc){
|
||||||
require_once('include/Scrape.php');
|
require_once('include/Scrape.php');
|
||||||
require_once("include/socgraph.php");
|
require_once("include/socgraph.php");
|
||||||
|
|
||||||
load_config('config');
|
Config::load();
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
$a->set_baseurl(get_config('system','url'));
|
$a->set_baseurl(get_config('system','url'));
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use \Friendica\Core\Config;
|
||||||
|
|
||||||
require_once('boot.php');
|
require_once('boot.php');
|
||||||
require_once('object/BaseObject.php');
|
require_once('object/BaseObject.php');
|
||||||
|
|
||||||
|
@ -54,8 +56,7 @@ if(!$install) {
|
||||||
* Load configs from db. Overwrite configs from .htconfig.php
|
* Load configs from db. Overwrite configs from .htconfig.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
load_config('config');
|
Config::load();
|
||||||
load_config('system');
|
|
||||||
|
|
||||||
if ($a->max_processes_reached() OR $a->maxload_reached()) {
|
if ($a->max_processes_reached() OR $a->maxload_reached()) {
|
||||||
header($_SERVER["SERVER_PROTOCOL"].' 503 Service Temporarily Unavailable');
|
header($_SERVER["SERVER_PROTOCOL"].' 503 Service Temporarily Unavailable');
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use \Friendica\Core\Config;
|
||||||
|
|
||||||
function friendica_init(App $a) {
|
function friendica_init(App $a) {
|
||||||
if ($a->argv[1]=="json"){
|
if ($a->argv[1]=="json"){
|
||||||
$register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN');
|
$register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN');
|
||||||
|
@ -29,7 +31,7 @@ function friendica_init(App $a) {
|
||||||
$visible_plugins[] = $rr['name'];
|
$visible_plugins[] = $rr['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
load_config('feature_lock');
|
Config::load('feature_lock');
|
||||||
$locked_features = array();
|
$locked_features = array();
|
||||||
if(is_array($a->config['feature_lock']) && count($a->config['feature_lock'])) {
|
if(is_array($a->config['feature_lock']) && count($a->config['feature_lock'])) {
|
||||||
foreach($a->config['feature_lock'] as $k => $v) {
|
foreach($a->config['feature_lock'] as $k => $v) {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use \Friendica\Core\Config;
|
||||||
|
|
||||||
require_once("boot.php");
|
require_once("boot.php");
|
||||||
|
|
||||||
$a = new App;
|
$a = new App;
|
||||||
|
@ -10,9 +12,9 @@ load_translation_table($lang);
|
||||||
|
|
||||||
require_once("include/dba.php");
|
require_once("include/dba.php");
|
||||||
$db = new dba($db_host, $db_user, $db_pass, $db_data, false);
|
$db = new dba($db_host, $db_user, $db_pass, $db_data, false);
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
unset($db_host, $db_user, $db_pass, $db_data);
|
||||||
load_config('config');
|
|
||||||
load_config('system');
|
Config::load();
|
||||||
|
|
||||||
$maint_mode = 1;
|
$maint_mode = 1;
|
||||||
if($argc > 1)
|
if($argc > 1)
|
||||||
|
|
Loading…
Reference in a new issue