Issue-#3873

Replace deprecated functions with new syntax.
This commit is contained in:
Adam Magness 2017-11-06 21:22:52 -05:00
parent 9eb1f4b9c3
commit 0dfa57948f
124 changed files with 819 additions and 679 deletions

View file

@ -23,6 +23,7 @@ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'a
use Friendica\App;
use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Util\Lock;
require_once 'include/config.php';
@ -603,9 +604,9 @@ function is_ajax() {
*/
function check_db($via_worker) {
$build = get_config('system', 'build');
$build = Config::get('system', 'build');
if (!x($build)) {
set_config('system', 'build', DB_UPDATE_VERSION);
Config::set('system', 'build', DB_UPDATE_VERSION);
$build = DB_UPDATE_VERSION;
}
if ($build != DB_UPDATE_VERSION) {
@ -622,7 +623,7 @@ function check_db($via_worker) {
*/
function check_url(App $a) {
$url = get_config('system', 'url');
$url = Config::get('system', 'url');
// if the url isn't set or the stored url is radically different
// than the currently visited url, store the current value accordingly.
@ -631,10 +632,10 @@ function check_url(App $a) {
// We will only change the url to an ip address if there is no existing setting
if (!x($url)) {
$url = set_config('system', 'url', System::baseUrl());
$url = Config::set('system', 'url', System::baseUrl());
}
if ((!link_compare($url, System::baseUrl())) && (!preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $a->get_hostname))) {
$url = set_config('system', 'url', System::baseUrl());
$url = Config::set('system', 'url', System::baseUrl());
}
return;
@ -644,9 +645,9 @@ function check_url(App $a) {
* @brief Automatic database updates
*/
function update_db(App $a) {
$build = get_config('system', 'build');
$build = Config::get('system', 'build');
if (!x($build)) {
$build = set_config('system', 'build', DB_UPDATE_VERSION);
$build = Config::set('system', 'build', DB_UPDATE_VERSION);
}
if ($build != DB_UPDATE_VERSION) {
@ -664,12 +665,12 @@ function update_db(App $a) {
if (DB_UPDATE_VERSION == UPDATE_VERSION) {
// Compare the current structure with the defined structure
$t = get_config('database', 'dbupdate_' . DB_UPDATE_VERSION);
$t = Config::get('database', 'dbupdate_' . DB_UPDATE_VERSION);
if ($t !== false) {
return;
}
set_config('database', 'dbupdate_' . DB_UPDATE_VERSION, time());
Config::set('database', 'dbupdate_' . DB_UPDATE_VERSION, time());
// run old update routine (wich could modify the schema and
// conflits with new routine)
@ -693,7 +694,7 @@ function update_db(App $a) {
);
return;
} else {
set_config('database', 'dbupdate_' . DB_UPDATE_VERSION, 'success');
Config::set('database', 'dbupdate_' . DB_UPDATE_VERSION, 'success');
}
// run any left update_nnnn functions in update.php
@ -720,11 +721,11 @@ function run_update_function($x) {
// If the update fails or times-out completely you may need to
// delete the config entry to try again.
$t = get_config('database', 'update_' . $x);
$t = Config::get('database', 'update_' . $x);
if ($t !== false) {
return false;
}
set_config('database', 'update_' . $x, time());
Config::set('database', 'update_' . $x, time());
// call the specific update
@ -739,13 +740,13 @@ function run_update_function($x) {
);
return false;
} else {
set_config('database', 'update_' . $x, 'success');
set_config('system', 'build', $x + 1);
Config::set('database', 'update_' . $x, 'success');
Config::set('system', 'build', $x + 1);
return true;
}
} else {
set_config('database', 'update_' . $x, 'success');
set_config('system', 'build', $x + 1);
Config::set('database', 'update_' . $x, 'success');
Config::set('system', 'build', $x + 1);
return true;
}
return true;
@ -774,7 +775,7 @@ function check_plugins(App $a) {
$installed = array();
}
$plugins = get_config('system', 'addon');
$plugins = Config::get('system', 'addon');
$plugins_arr = array();
if ($plugins) {
@ -852,7 +853,7 @@ function login($register = false, $hiddens = false) {
);
}
$noid = get_config('system', 'no_openid');
$noid = Config::get('system', 'no_openid');
$dest_url = $a->query_string;
@ -1007,7 +1008,7 @@ function notice($s) {
function info($s) {
$a = get_app();
if (local_user() && get_pconfig(local_user(), 'system', 'ignore_info')) {
if (local_user() && PConfig::get(local_user(), 'system', 'ignore_info')) {
return;
}
@ -1063,7 +1064,7 @@ function current_theme() {
// This works only if the user is on the same server
if ($page_theme && local_user() && (local_user() != $a->profile_uid)) {
if (get_pconfig(local_user(), 'system', 'always_my_theme')) {
if (PConfig::get(local_user(), 'system', 'always_my_theme')) {
$page_theme = null;
}
}
@ -1304,7 +1305,7 @@ function random_digits($digits) {
}
function get_server() {
$server = get_config("system", "directory");
$server = Config::get("system", "directory");
if ($server == "") {
$server = "http://dir.friendica.social";
@ -1316,7 +1317,7 @@ function get_server() {
function get_temppath() {
$a = get_app();
$temppath = get_config("system", "temppath");
$temppath = Config::get("system", "temppath");
if (($temppath != "") && App::directory_usable($temppath)) {
// We have a temp path and it is usable
@ -1340,7 +1341,7 @@ function get_temppath() {
if (App::directory_usable($new_temppath)) {
// The new path is usable, we are happy
set_config("system", "temppath", $new_temppath);
Config::set("system", "temppath", $new_temppath);
return $new_temppath;
} else {
// We can't create a subdirectory, strange.
@ -1389,7 +1390,7 @@ function clear_cache($basepath = "", $path = "") {
return;
}
$cachetime = (int) get_config('system', 'itemcache_duration');
$cachetime = (int) Config::get('system', 'itemcache_duration');
if ($cachetime == 0) {
$cachetime = 86400;
}
@ -1412,12 +1413,12 @@ function clear_cache($basepath = "", $path = "") {
function get_itemcachepath() {
// Checking, if the cache is deactivated
$cachetime = (int) get_config('system', 'itemcache_duration');
$cachetime = (int) Config::get('system', 'itemcache_duration');
if ($cachetime < 0) {
return "";
}
$itemcache = get_config('system', 'itemcache');
$itemcache = Config::get('system', 'itemcache');
if (($itemcache != "") && App::directory_usable($itemcache)) {
return App::realpath($itemcache);
}
@ -1431,7 +1432,7 @@ function get_itemcachepath() {
}
if (App::directory_usable($itemcache)) {
set_config("system", "itemcache", $itemcache);
Config::set("system", "itemcache", $itemcache);
return $itemcache;
}
}
@ -1444,7 +1445,7 @@ function get_itemcachepath() {
* @return string Spool path
*/
function get_spoolpath() {
$spoolpath = get_config('system', 'spoolpath');
$spoolpath = Config::get('system', 'spoolpath');
if (($spoolpath != "") && App::directory_usable($spoolpath)) {
// We have a spool path and it is usable
return $spoolpath;
@ -1462,7 +1463,7 @@ function get_spoolpath() {
if (App::directory_usable($spoolpath)) {
// The new path is usable, we are happy
set_config("system", "spoolpath", $spoolpath);
Config::set("system", "spoolpath", $spoolpath);
return $spoolpath;
} else {
// We can't create a subdirectory, strange.
@ -1574,7 +1575,7 @@ function argv($x) {
*/
function infinite_scroll_data($module) {
if (get_pconfig(local_user(), 'system', 'infinite_scroll')
if (PConfig::get(local_user(), 'system', 'infinite_scroll')
&& ($module == "network") && ($_GET["mode"] != "minimal")) {
// get the page number

View file

@ -130,7 +130,7 @@ The selected 1st part will be saved in the database by the theme_post function.
// if the one specific submit button was pressed then proceed
if (isset($_POST['duepuntozero-settings-submit'])){
// and save the selection key into the personal config of the user
set_pconfig(local_user(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
PConfig::set(local_user(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
}
}
@ -138,9 +138,9 @@ Now that this information is set in the database, what should friendica do with
For this, have a look at the theme.php file of the *duepunto zero*.
There you'll find somethink alike
$colorset = get_pconfig( local_user(), 'duepuntozero','colorset');
$colorset = PConfig::get( local_user(), 'duepuntozero','colorset');
if (!$colorset)
$colorset = get_config('duepuntozero', 'colorset');
$colorset = Config::get('duepuntozero', 'colorset');
if ($colorset) {
if ($colorset == 'greenzero')
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/greenzero.css" type="text/css" media="screen" />'."\n";

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,7 @@
<?php
use Friendica\App;
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Network\Probe;
@ -50,7 +51,7 @@ function contact_remove($id) {
return;
}
$archive = get_pconfig($r[0]['uid'], 'system','archive_removed_contacts');
$archive = PConfig::get($r[0]['uid'], 'system','archive_removed_contacts');
if ($archive) {
q("update contact set `archive` = 1, `network` = 'none', `writable` = 0 where id = %d",
intval($id)

View file

@ -5,6 +5,7 @@
* @brief This file includes the DirSearch class with directory related functions
*/
use Friendica\Core\Config;
/**
* @brief This class handels directory related functions
@ -22,12 +23,12 @@ class DirSearch {
if($search) {
// check supported networks
if (get_config('system','diaspora_enabled'))
if (Config::get('system','diaspora_enabled'))
$diaspora = NETWORK_DIASPORA;
else
$diaspora = NETWORK_DFRN;
if (!get_config('system','ostatus_disabled'))
if (!Config::get('system','ostatus_disabled'))
$ostatus = NETWORK_OSTATUS;
else
$ostatus = NETWORK_DFRN;

View file

@ -1,5 +1,7 @@
<?php
use Friendica\Core\PConfig;
require_once('include/email.php');
class Emailer {
@ -22,7 +24,7 @@ class Emailer {
$email_textonly = False;
if (x($params,"uid")) {
$email_textonly = get_pconfig($params['uid'], "system", "email_textonly");
$email_textonly = PConfig::get($params['uid'], "system", "email_textonly");
}
$fromName = email_header_encode(html_entity_decode($params['fromName'],ENT_QUOTES,'UTF-8'),'UTF-8');

View file

@ -5,6 +5,7 @@
* or for formatting notifications
*/
use Friendica\Core\Pconfig;
use Friendica\Core\System;
require_once 'include/html2plain.php';
@ -781,7 +782,7 @@ class NotificationsManager {
'name' => $it['fname'],
'url' => zrl($it['furl']),
'hidden' => $it['hidden'] == 1,
'post_newfriend' => (intval(get_pconfig(local_user(),'system','post_newfriend')) ? '1' : 0),
'post_newfriend' => (intval(PConfig::get(local_user(),'system','post_newfriend')) ? '1' : 0),
'knowyou' => $knowyou,
'note' => $it['note'],
@ -814,7 +815,7 @@ class NotificationsManager {
'keywords' => $it['gkeywords'],
'gender' => $it['ggender'],
'hidden' => $it['hidden'] == 1,
'post_newfriend' => (intval(get_pconfig(local_user(),'system','post_newfriend')) ? '1' : 0),
'post_newfriend' => (intval(PConfig::get(local_user(),'system','post_newfriend')) ? '1' : 0),
'url' => $it['url'],
'zrl' => zrl($it['url']),
'addr' => $it['gaddr'],

View file

@ -5,6 +5,7 @@
*/
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\System;
require_once("include/photos.php");
@ -119,7 +120,7 @@ class Photo {
*/
switch($this->getType()){
case "image/png":
$quality = get_config('system', 'png_quality');
$quality = Config::get('system', 'png_quality');
if ((! $quality) || ($quality > 9)) {
$quality = PNG_QUALITY;
}
@ -135,7 +136,7 @@ class Photo {
$this->image->setCompressionQuality($quality);
break;
case "image/jpeg":
$quality = get_config('system', 'jpeg_quality');
$quality = Config::get('system', 'jpeg_quality');
if ((! $quality) || ($quality > 100)) {
$quality = JPEG_QUALITY;
}
@ -605,14 +606,14 @@ class Photo {
switch($this->getType()){
case "image/png":
$quality = get_config('system', 'png_quality');
$quality = Config::get('system', 'png_quality');
if ((!$quality) || ($quality > 9)) {
$quality = PNG_QUALITY;
}
imagepng($this->image, null, $quality);
break;
case "image/jpeg":
$quality = get_config('system', 'jpeg_quality');
$quality = Config::get('system', 'jpeg_quality');
if ((!$quality) || ($quality > 100)) {
$quality = JPEG_QUALITY;
}
@ -940,7 +941,7 @@ function store_photo(App $a, $uid, $imagedata = "", $url = "") {
$a->save_timestamp($stamp1, "file");
}
$maximagesize = get_config('system', 'maximagesize');
$maximagesize = Config::get('system', 'maximagesize');
if (($maximagesize) && (strlen($imagedata) > $maximagesize)) {
logger("Image exceeds size limit of ".$maximagesize, LOGGER_DEBUG);
@ -972,7 +973,7 @@ function store_photo(App $a, $uid, $imagedata = "", $url = "") {
$ph->orient($tempfile);
unlink($tempfile);
$max_length = get_config('system', 'max_image_length');
$max_length = Config::get('system', 'max_image_length');
if (! $max_length) {
$max_length = MAX_IMAGE_LENGTH;
}

View file

@ -14,6 +14,8 @@
*/
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Core\System;
/**
@ -156,8 +158,8 @@ class Smilies {
* @return string HML Output of the Smilie
*/
public static function replace($s, $sample = false, $no_images = false) {
if(intval(get_config('system','no_smilies'))
|| (local_user() && intval(get_pconfig(local_user(),'system','no_smilies'))))
if(intval(Config::get('system','no_smilies'))
|| (local_user() && intval(PConfig::get(local_user(),'system','no_smilies'))))
return $s;
$s = preg_replace_callback('/<pre>(.*?)<\/pre>/ism','self::encode',$s);

View file

@ -5,6 +5,7 @@
*/
use Friendica\App;
use Friendica\Core\Config;
require_once "include/contact_selectors.php";
require_once "include/contact_widgets.php";
@ -332,7 +333,7 @@ function populate_acl($user = null, $show_jotnets = false) {
$jotnets = '';
if ($show_jotnets) {
$mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
$mail_disabled = ((function_exists('imap_open') && (! Config::get('system','imap_disabled'))) ? 0 : 1);
$mail_enabled = false;
$pubmail_enabled = false;
@ -757,12 +758,12 @@ function navbar_complete(App $a) {
// logger('navbar_complete');
if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
if ((Config::get('system','block_public')) && (! local_user()) && (! remote_user())) {
return;
}
// check if searching in the local global contact table is enabled
$localsearch = get_config('system','poco_local_search');
$localsearch = Config::get('system','poco_local_search');
$search = $prefix.notags(trim($_REQUEST['search']));
$mode = $_REQUEST['smode'];

View file

@ -297,7 +297,7 @@ $called_api = null;
$duration = (float) (microtime(true) - $stamp);
logger("API call duration: " . round($duration, 2) . "\t" . $a->query_string, LOGGER_DEBUG);
if (get_config("system", "profiler")) {
if (Config::get("system", "profiler")) {
$duration = microtime(true)-$a->performance["start"];
/// @TODO round() really everywhere?
@ -312,7 +312,7 @@ $called_api = null;
LOGGER_DEBUG
);
if (get_config("rendertime", "callstack")) {
if (Config::get("rendertime", "callstack")) {
$o = "Database Read:\n";
foreach ($a->callstack["database"] AS $func => $time) {
$time = round($time, 3);
@ -1084,7 +1084,7 @@ $called_api = null;
$_REQUEST['type'] = 'net-comment';
} else {
// Check for throttling (maximum posts per day, week and month)
$throttle_day = get_config('system','throttle_limit_day');
$throttle_day = Config::get('system','throttle_limit_day');
if ($throttle_day > 0) {
$datefrom = date("Y-m-d H:i:s", time() - 24*60*60);
@ -1105,7 +1105,7 @@ $called_api = null;
}
}
$throttle_week = get_config('system','throttle_limit_week');
$throttle_week = Config::get('system','throttle_limit_week');
if ($throttle_week > 0) {
$datefrom = date("Y-m-d H:i:s", time() - 24*60*60*7);
@ -1126,7 +1126,7 @@ $called_api = null;
}
}
$throttle_month = get_config('system','throttle_limit_month');
$throttle_month = Config::get('system','throttle_limit_month');
if ($throttle_month > 0) {
$datefrom = date("Y-m-d H:i:s", time() - 24*60*60*30);
@ -2464,7 +2464,7 @@ $called_api = null;
if ($image) {
// If image cache is activated, then use the following sizes:
// thumb (150), small (340), medium (600) and large (1024)
if (!get_config("system", "proxy_disabled")) {
if (!Config::get("system", "proxy_disabled")) {
$media_url = proxy_url($url);
$sizes = array();
@ -3761,7 +3761,7 @@ $called_api = null;
// Update global directory in background
//$user = api_get_user(get_app());
$url = System::baseUrl() . '/profile/' . get_app()->user['nickname'];
if ($url && strlen(get_config('system', 'directory'))) {
if ($url && strlen(Config::get('system', 'directory'))) {
Worker::add(PRIORITY_LOW, "directory", $url);
}
@ -3854,7 +3854,7 @@ $called_api = null;
throw new InternalServerErrorException("image size exceeds PHP config settings, file was rejected by server");
}
// check against max upload size within Friendica instance
$maximagesize = get_config('system', 'maximagesize');
$maximagesize = Config::get('system', 'maximagesize');
if (($maximagesize) && ($filesize > $maximagesize)) {
$formattedBytes = formatBytes($maximagesize);
throw new InternalServerErrorException("image size exceeds Friendica config setting (uploaded size: $formattedBytes)");
@ -3872,7 +3872,7 @@ $called_api = null;
@unlink($src);
// check max length of images on server
$max_length = get_config('system', 'max_image_length');
$max_length = Config::get('system', 'max_image_length');
if (! $max_length) {
$max_length = MAX_IMAGE_LENGTH;
}
@ -4947,7 +4947,7 @@ $called_api = null;
// retrieve general information about profiles for user
$multi_profiles = feature_enabled(api_user(),'multi_profiles');
$directory = get_config('system', 'directory');
$directory = Config::get('system', 'directory');
// get data of the specified profile id or all profiles of the user if not specified
if ($profileid != 0) {

View file

@ -33,7 +33,7 @@ if (isset($_COOKIE["Friendica"])) {
if (!isset($_SESSION) || !isset($_SESSION['authenticated'])) {
authenticate_success($r[0]);
if (get_config('system','paranoia'))
if (Config::get('system','paranoia'))
$_SESSION['addr'] = $data->ip;
}
}
@ -67,7 +67,7 @@ if (isset($_SESSION) && x($_SESSION,'authenticated') && (!x($_POST,'auth-params'
// already logged in user returning
$check = get_config('system','paranoia');
$check = Config::get('system','paranoia');
// extra paranoia - if the IP changed, log them out
if ($check && ($_SESSION['addr'] != $_SERVER['REMOTE_ADDR'])) {
logger('Session address changed. Paranoid setting in effect, blocking session. '.
@ -109,7 +109,7 @@ if (isset($_SESSION) && x($_SESSION,'authenticated') && (!x($_POST,'auth-params'
if ((x($_POST,'openid_url')) && strlen($_POST['openid_url']) ||
(x($_POST,'username')) && strlen($_POST['username'])) {
$noid = get_config('system','no_openid');
$noid = Config::get('system','no_openid');
$openid_url = trim((strlen($_POST['openid_url'])?$_POST['openid_url']:$_POST['username']));

View file

@ -913,7 +913,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
$Text = str_replace("\r\n", "\n", $Text);
// removing multiplicated newlines
if (get_config("system", "remove_multiplicated_lines")) {
if (Config::get("system", "remove_multiplicated_lines")) {
$search = array("\n\n\n", "\n ", " \n", "[/quote]\n\n", "\n[/quote]", "[/li]\n", "\n[li]", "\n[ul]", "[/ul]\n", "\n\n[share ", "[/attachment]\n",
"\n[h1]", "[/h1]\n", "\n[h2]", "[/h2]\n", "\n[h3]", "[/h3]\n", "\n[h4]", "[/h4]\n", "\n[h5]", "[/h5]\n", "\n[h6]", "[/h6]\n");
$replace = array("\n\n", "\n", "\n", "[/quote]\n", "[/quote]", "[/li]", "[li]", "[ul]", "[/ul]", "\n[share ", "[/attachment]",

View file

@ -154,7 +154,7 @@ class Cache {
public static function clear($max_level = CACHE_MONTH) {
// Clear long lasting cache entries only once a day
if (get_config("system", "cache_cleared_day") < time() - self::duration(CACHE_DAY)) {
if (Config::get("system", "cache_cleared_day") < time() - self::duration(CACHE_DAY)) {
if ($max_level == CACHE_MONTH) {
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
dbesc(datetime_convert('UTC','UTC',"now - 30 days")), intval(CACHE_MONTH));
@ -169,42 +169,42 @@ class Cache {
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
dbesc(datetime_convert('UTC','UTC',"now - 1 days")), intval(CACHE_DAY));
}
set_config("system", "cache_cleared_day", time());
Config::set("system", "cache_cleared_day", time());
}
if (($max_level <= CACHE_HOUR) && (get_config("system", "cache_cleared_hour")) < time() - self::duration(CACHE_HOUR)) {
if (($max_level <= CACHE_HOUR) && (Config::get("system", "cache_cleared_hour")) < time() - self::duration(CACHE_HOUR)) {
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
dbesc(datetime_convert('UTC','UTC',"now - 1 hours")), intval(CACHE_HOUR));
set_config("system", "cache_cleared_hour", time());
Config::set("system", "cache_cleared_hour", time());
}
if (($max_level <= CACHE_HALF_HOUR) && (get_config("system", "cache_cleared_half_hour")) < time() - self::duration(CACHE_HALF_HOUR)) {
if (($max_level <= CACHE_HALF_HOUR) && (Config::get("system", "cache_cleared_half_hour")) < time() - self::duration(CACHE_HALF_HOUR)) {
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
dbesc(datetime_convert('UTC','UTC',"now - 30 minutes")), intval(CACHE_HALF_HOUR));
set_config("system", "cache_cleared_half_hour", time());
Config::set("system", "cache_cleared_half_hour", time());
}
if (($max_level <= CACHE_QUARTER_HOUR) && (get_config("system", "cache_cleared_quarter_hour")) < time() - self::duration(CACHE_QUARTER_HOUR)) {
if (($max_level <= CACHE_QUARTER_HOUR) && (Config::get("system", "cache_cleared_quarter_hour")) < time() - self::duration(CACHE_QUARTER_HOUR)) {
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
dbesc(datetime_convert('UTC','UTC',"now - 15 minutes")), intval(CACHE_QUARTER_HOUR));
set_config("system", "cache_cleared_quarter_hour", time());
Config::set("system", "cache_cleared_quarter_hour", time());
}
if (($max_level <= CACHE_FIVE_MINUTES) && (get_config("system", "cache_cleared_five_minute")) < time() - self::duration(CACHE_FIVE_MINUTES)) {
if (($max_level <= CACHE_FIVE_MINUTES) && (Config::get("system", "cache_cleared_five_minute")) < time() - self::duration(CACHE_FIVE_MINUTES)) {
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
dbesc(datetime_convert('UTC','UTC',"now - 5 minutes")), intval(CACHE_FIVE_MINUTES));
set_config("system", "cache_cleared_five_minute", time());
Config::set("system", "cache_cleared_five_minute", time());
}
if (($max_level <= CACHE_MINUTE) && (get_config("system", "cache_cleared_minute")) < time() - self::duration(CACHE_MINUTE)) {
if (($max_level <= CACHE_MINUTE) && (Config::get("system", "cache_cleared_minute")) < time() - self::duration(CACHE_MINUTE)) {
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
dbesc(datetime_convert('UTC','UTC',"now - 1 minutes")), intval(CACHE_MINUTE));
set_config("system", "cache_cleared_minute", time());
Config::set("system", "cache_cleared_minute", time());
}
}
}

View file

@ -23,7 +23,7 @@ function cli_startup() {
Config::load();
$a->set_baseurl(get_config('system','url'));
$a->set_baseurl(Config::get('system','url'));
load_hooks();
}

View file

@ -3,6 +3,7 @@
use Friendica\App;
use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
require_once 'include/contact_selectors.php';
@ -24,8 +25,8 @@ function findpeople_widget() {
$a = get_app();
$global_dir = Config::get('system', 'directory');
if (get_config('system', 'invitation_only')) {
$x = get_pconfig(local_user(), 'system', 'invites_remaining');
if (Config::get('system', 'invitation_only')) {
$x = PConfig::get(local_user(), 'system', 'invites_remaining');
if ($x || is_site_admin()) {
$a->page['aside'] .= '<div class="side-link" id="side-invite-remain">'
. sprintf( tt('%d invitation available', '%d invitations available', $x), $x)
@ -74,11 +75,11 @@ function unavailable_networks() {
$networks[] = NETWORK_TWITTER;
}
if (get_config("system", "ostatus_disabled")) {
if (Config::get("system", "ostatus_disabled")) {
$networks[] = NETWORK_OSTATUS;
}
if (!get_config("system", "diaspora_enabled")) {
if (!Config::get("system", "diaspora_enabled")) {
$networks[] = NETWORK_DIASPORA;
}
@ -148,7 +149,7 @@ function fileas_widget($baseurl, $selected = '') {
return '';
}
$saved = get_pconfig(local_user(), 'system', 'filetags');
$saved = PConfig::get(local_user(), 'system', 'filetags');
if (! strlen($saved)) {
return;
}
@ -182,7 +183,7 @@ function categories_widget($baseurl, $selected = '') {
return '';
}
$saved = get_pconfig($a->profile['profile_uid'], 'system', 'filetags');
$saved = PConfig::get($a->profile['profile_uid'], 'system', 'filetags');
if (! strlen($saved)) {
return;
}

View file

@ -1,6 +1,8 @@
<?php
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Core\System;
require_once "include/bbcode.php";
@ -517,7 +519,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
$arr_blocked = null;
if (local_user()) {
$str_blocked = get_pconfig(local_user(), 'system', 'blocked');
$str_blocked = PConfig::get(local_user(), 'system', 'blocked');
if ($str_blocked) {
$arr_blocked = explode(',', $str_blocked);
for ($x = 0; $x < count($arr_blocked); $x ++) {
@ -1363,7 +1365,7 @@ function get_item_children($arr, $parent) {
$a = get_app();
foreach ($arr as $item) {
if ($item['id'] != $item['parent']) {
if (get_config('system', 'thread_allow') && $a->theme_thread_allow) {
if (Config::get('system', 'thread_allow') && $a->theme_thread_allow) {
// Fallback to parent-uri if thr-parent is not set
$thr_parent = $item['thr-parent'];
if ($thr_parent == '') {

View file

@ -14,9 +14,9 @@ function cron_run(&$argv, &$argc){
return;
}
$last = get_config('system', 'last_cron');
$last = Config::get('system', 'last_cron');
$poll_interval = intval(get_config('system', 'cron_interval'));
$poll_interval = intval(Config::get('system', 'cron_interval'));
if (! $poll_interval) {
$poll_interval = 10;
}
@ -59,7 +59,7 @@ function cron_run(&$argv, &$argc){
Worker::add(PRIORITY_LOW, "cronjobs", "repair_database");
// once daily run birthday_updates and then expire in background
$d1 = get_config('system', 'last_expire_day');
$d1 = Config::get('system', 'last_expire_day');
$d2 = intval(datetime_convert('UTC', 'UTC', 'now', 'd'));
if ($d2 != intval($d1)) {
@ -70,7 +70,7 @@ function cron_run(&$argv, &$argc){
Worker::add(PRIORITY_LOW, "discover_poco", "suggestions");
set_config('system', 'last_expire_day', $d2);
Config::set('system', 'last_expire_day', $d2);
Worker::add(PRIORITY_LOW, 'expire');
@ -90,7 +90,7 @@ function cron_run(&$argv, &$argc){
logger('cron: end');
set_config('system', 'last_cron', time());
Config::set('system', 'last_cron', time());
return;
}
@ -135,7 +135,7 @@ function cron_poll_contacts($argc, $argv) {
// and which have a polling address and ignore Diaspora since
// we are unable to match those posts with a Diaspora GUID and prevent duplicates.
$abandon_days = intval(get_config('system', 'account_abandon_days'));
$abandon_days = intval(Config::get('system', 'account_abandon_days'));
if ($abandon_days < 1) {
$abandon_days = 0;
}
@ -194,7 +194,7 @@ function cron_poll_contacts($argc, $argv) {
* This also lets us update our subscription to the hub, and add or replace hubs in case it
* changed. We will only update hubs once a day, regardless of 'pushpoll_frequency'.
*/
$poll_interval = get_config('system', 'pushpoll_frequency');
$poll_interval = Config::get('system', 'pushpoll_frequency');
$contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3);
}

View file

@ -18,9 +18,9 @@ function cronhooks_run(&$argv, &$argc) {
return;
}
$last = get_config('system', 'last_cronhook');
$last = Config::get('system', 'last_cronhook');
$poll_interval = intval(get_config('system', 'cronhook_interval'));
$poll_interval = intval(Config::get('system', 'cronhook_interval'));
if (! $poll_interval) {
$poll_interval = 9;
}
@ -33,7 +33,7 @@ function cronhooks_run(&$argv, &$argc) {
}
}
$a->set_baseurl(get_config('system', 'url'));
$a->set_baseurl(Config::get('system', 'url'));
logger('cronhooks: start');
@ -48,7 +48,7 @@ function cronhooks_run(&$argv, &$argc) {
logger('cronhooks: end');
set_config('system', 'last_cronhook', time());
Config::set('system', 'last_cronhook', time());
return;
}

View file

@ -112,7 +112,7 @@ function cron_expire_and_remove_users() {
*/
function cron_clear_cache(App $a) {
$last = get_config('system','cache_last_cleared');
$last = Config::get('system','cache_last_cleared');
if ($last) {
$next = $last + (3600); // Once per hour
@ -138,10 +138,10 @@ function cron_clear_cache(App $a) {
clear_cache($a->get_basepath()."/view/smarty3/compiled", $a->get_basepath()."/view/smarty3/compiled");
// clear cache for image proxy
if (!get_config("system", "proxy_disabled")) {
if (!Config::get("system", "proxy_disabled")) {
clear_cache($a->get_basepath(), $a->get_basepath()."/proxy");
$cachetime = get_config('system','proxy_cache_time');
$cachetime = Config::get('system','proxy_cache_time');
if (!$cachetime) {
$cachetime = PROXY_DEFAULT_TIME;
}
@ -155,13 +155,13 @@ function cron_clear_cache(App $a) {
q("DELETE FROM `parsed_url` WHERE `created` < NOW() - INTERVAL 3 MONTH");
// Maximum table size in megabyte
$max_tablesize = intval(get_config('system','optimize_max_tablesize')) * 1000000;
$max_tablesize = intval(Config::get('system','optimize_max_tablesize')) * 1000000;
if ($max_tablesize == 0) {
$max_tablesize = 100 * 1000000; // Default are 100 MB
}
if ($max_tablesize > 0) {
// Minimum fragmentation level in percent
$fragmentation_level = intval(get_config('system','optimize_fragmentation')) / 100;
$fragmentation_level = intval(Config::get('system','optimize_fragmentation')) / 100;
if ($fragmentation_level == 0) {
$fragmentation_level = 0.3; // Default value is 30%
}
@ -196,7 +196,7 @@ function cron_clear_cache(App $a) {
}
}
set_config('system','cache_last_cleared', time());
Config::set('system','cache_last_cleared', time());
}
/**

View file

@ -1,5 +1,7 @@
<?php
use Friendica\Core\Config;
require_once 'library/ASNValue.class.php';
require_once 'library/asn1.php';
@ -146,7 +148,7 @@ function new_keypair($bits) {
'encrypt_key' => false
);
$conf = get_config('system', 'openssl_conf_file');
$conf = Config::get('system', 'openssl_conf_file');
if ($conf) {
$openssl_options['config'] = $conf;
}

View file

@ -5,6 +5,7 @@
*/
use Friendica\Core\Config;
use Friendica\Core\PConfig;
/**
* @brief Two-level sort for timezones.
@ -178,7 +179,7 @@ function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d
function dob($dob) {
list($year,$month,$day) = sscanf($dob,'%4d-%2d-%2d');
$f = get_config('system', 'birthday_input_format');
$f = Config::get('system', 'birthday_input_format');
if (! $f) {
$f = 'ymd';
}
@ -279,7 +280,7 @@ function timesel($format, $h, $m, $id = 'timepicker') {
function datetimesel($format, $min, $max, $default, $label, $id = 'datetimepicker', $pickdate = true, $picktime = true, $minfrom = '', $maxfrom = '', $required = false) {
// First day of the week (0 = Sunday)
$firstDay = get_pconfig(local_user(), 'system', 'first_day_of_week');
$firstDay = PConfig::get(local_user(), 'system', 'first_day_of_week');
if ($firstDay === false) {
$firstDay=0;
}

View file

@ -1781,9 +1781,9 @@ function dbstructure_run(&$argv, &$argc) {
case "update":
update_structure(true, true);
$build = get_config('system','build');
$build = Config::get('system','build');
if (!x($build)) {
set_config('system', 'build', DB_UPDATE_VERSION);
Config::set('system', 'build', DB_UPDATE_VERSION);
$build = DB_UPDATE_VERSION;
}
@ -1798,7 +1798,7 @@ function dbstructure_run(&$argv, &$argc) {
}
}
set_config('system','build',DB_UPDATE_VERSION);
Config::set('system','build',DB_UPDATE_VERSION);
return;
case "dumpsql":
print_structure(db_definition());

View file

@ -335,7 +335,7 @@ function delivery_run(&$argv, &$argc){
$x[0]['writable'] = 1;
}
$ssl_policy = get_config('system','ssl_policy');
$ssl_policy = Config::get('system','ssl_policy');
fix_contact_ssl_policy($x[0],$ssl_policy);
// If we are setup as a soapbox we aren't accepting top level posts from this person
@ -375,7 +375,7 @@ function delivery_run(&$argv, &$argc){
if ($owner['prvnets']) {
break;
}
if (get_config('system','ostatus_disabled') || get_config('system','dfrn_only')) {
if (Config::get('system','ostatus_disabled') || Config::get('system','dfrn_only')) {
break;
}
@ -386,7 +386,7 @@ function delivery_run(&$argv, &$argc){
case NETWORK_MAIL:
case NETWORK_MAIL2:
if (get_config('system','dfrn_only')) {
if (Config::get('system','dfrn_only')) {
break;
}
// WARNING: does not currently convert to RFC2047 header encodings, etc.
@ -489,7 +489,7 @@ function delivery_run(&$argv, &$argc){
logger('delivery: diaspora batch deliver: '.$loc);
if (get_config('system','dfrn_only') || (!get_config('system','diaspora_enabled')))
if (Config::get('system','dfrn_only') || (!Config::get('system','diaspora_enabled')))
break;
if ($mail) {

View file

@ -8,6 +8,7 @@
*/
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Core\Worker;
@ -442,11 +443,11 @@ class dfrn {
public static function relocate($owner, $uid) {
/* get site pubkey. this could be a new installation with no site keys*/
$pubkey = get_config('system','site_pubkey');
$pubkey = Config::get('system','site_pubkey');
if (! $pubkey) {
$res = new_keypair(1024);
set_config('system','site_prvkey', $res['prvkey']);
set_config('system','site_pubkey', $res['pubkey']);
Config::set('system','site_prvkey', $res['prvkey']);
Config::set('system','site_pubkey', $res['pubkey']);
}
$rp = q("SELECT `resource-id` , `scale`, type FROM `photo`
@ -478,7 +479,7 @@ class dfrn {
xml::add_element($doc, $relocate, "dfrn:confirm", $owner['confirm']);
xml::add_element($doc, $relocate, "dfrn:notify", $owner['notify']);
xml::add_element($doc, $relocate, "dfrn:poll", $owner['poll']);
xml::add_element($doc, $relocate, "dfrn:sitepubkey", get_config('system','site_pubkey'));
xml::add_element($doc, $relocate, "dfrn:sitepubkey", Config::get('system','site_pubkey'));
$root->appendChild($relocate);
@ -1103,12 +1104,12 @@ class dfrn {
$idtosend = '1:' . $orig_id;
}
$rino = get_config('system', 'rino_encrypt');
$rino = Config::get('system', 'rino_encrypt');
$rino = intval($rino);
logger("Local rino version: ". $rino, LOGGER_DEBUG);
$ssl_val = intval(get_config('system','ssl_policy'));
$ssl_val = intval(Config::get('system','ssl_policy'));
$ssl_policy = '';
switch ($ssl_val) {

View file

@ -42,7 +42,7 @@ class Diaspora {
*/
public static function relay_list() {
$serverdata = get_config("system", "relay_server");
$serverdata = Config::get("system", "relay_server");
if ($serverdata == "")
return array();
@ -411,7 +411,7 @@ class Diaspora {
*/
public static function dispatch_public($msg) {
$enabled = intval(get_config("system", "diaspora_enabled"));
$enabled = intval(Config::get("system", "diaspora_enabled"));
if (!$enabled) {
logger("diaspora is disabled");
return false;
@ -740,7 +740,7 @@ class Diaspora {
if (!$person || $update) {
logger("create or refresh", LOGGER_DEBUG);
$r = probe_url($handle, PROBE_DIASPORA);
$r = Probe::uri($handle, NETWORK_DIASPORA);
// Note that Friendica contacts will return a "Diaspora person"
// if Diaspora connectivity is enabled on their server
@ -2151,7 +2151,7 @@ class Diaspora {
intval($importer["uid"])
);
if ($r && !$r[0]["hide-friends"] && !$contact["hidden"] && intval(get_pconfig($importer["uid"], "system", "post_newfriend"))) {
if ($r && !$r[0]["hide-friends"] && !$contact["hidden"] && intval(PConfig::get($importer["uid"], "system", "post_newfriend"))) {
$self = q("SELECT * FROM `contact` WHERE `self` AND `uid` = %d LIMIT 1",
intval($importer["uid"])
@ -2942,7 +2942,7 @@ class Diaspora {
$a = get_app();
$enabled = intval(get_config("system", "diaspora_enabled"));
$enabled = intval(Config::get("system", "diaspora_enabled"));
if (!$enabled)
return 200;