Move Config::set() to DI::config()->set()

This commit is contained in:
Philipp Holzer 2020-01-19 21:21:53 +01:00
parent 6c36fd9e01
commit 3411ced833
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
29 changed files with 213 additions and 229 deletions

View file

@ -88,7 +88,7 @@ if (is_readable($pidfile)) {
} }
if (empty($pid) && in_array($mode, ["stop", "status"])) { if (empty($pid) && in_array($mode, ["stop", "status"])) {
Config::set('system', 'worker_daemon_mode', false); DI::config()->set('system', 'worker_daemon_mode', false);
die("Pidfile wasn't found. Is the daemon running?\n"); die("Pidfile wasn't found. Is the daemon running?\n");
} }
@ -99,7 +99,7 @@ if ($mode == "status") {
unlink($pidfile); unlink($pidfile);
Config::set('system', 'worker_daemon_mode', false); DI::config()->set('system', 'worker_daemon_mode', false);
die("Daemon process $pid isn't running.\n"); die("Daemon process $pid isn't running.\n");
} }
@ -110,7 +110,7 @@ if ($mode == "stop") {
Logger::notice("Worker daemon process was killed", ["pid" => $pid]); Logger::notice("Worker daemon process was killed", ["pid" => $pid]);
Config::set('system', 'worker_daemon_mode', false); DI::config()->set('system', 'worker_daemon_mode', false);
die("Worker daemon process $pid was killed.\n"); die("Worker daemon process $pid was killed.\n");
} }
@ -153,7 +153,7 @@ if (!$foreground) {
DBA::reconnect(); DBA::reconnect();
} }
Config::set('system', 'worker_daemon_mode', true); DI::config()->set('system', 'worker_daemon_mode', true);
// Just to be sure that this script really runs endlessly // Just to be sure that this script really runs endlessly
set_time_limit(0); set_time_limit(0);

View file

@ -470,7 +470,7 @@ function get_temppath()
if (System::isDirectoryUsable($new_temppath)) { if (System::isDirectoryUsable($new_temppath)) {
// The new path is usable, we are happy // The new path is usable, we are happy
Config::set("system", "temppath", $new_temppath); DI::config()->set("system", "temppath", $new_temppath);
return $new_temppath; return $new_temppath;
} else { } else {
// We can't create a subdirectory, strange. // We can't create a subdirectory, strange.
@ -563,7 +563,7 @@ function get_itemcachepath()
} }
if (System::isDirectoryUsable($itemcache)) { if (System::isDirectoryUsable($itemcache)) {
Config::set("system", "itemcache", $itemcache); DI::config()->set("system", "itemcache", $itemcache);
return $itemcache; return $itemcache;
} }
} }
@ -595,7 +595,7 @@ function get_spoolpath()
if (System::isDirectoryUsable($spoolpath)) { if (System::isDirectoryUsable($spoolpath)) {
// The new path is usable, we are happy // The new path is usable, we are happy
Config::set("system", "spoolpath", $spoolpath); DI::config()->set("system", "spoolpath", $spoolpath);
return $spoolpath; return $spoolpath;
} else { } else {
// We can't create a subdirectory, strange. // We can't create a subdirectory, strange.

View file

@ -68,7 +68,7 @@ function api_content(App $a)
$consumer = new OAuthConsumer($app['client_id'], $app['pw'], $app['redirect_uri']); $consumer = new OAuthConsumer($app['client_id'], $app['pw'], $app['redirect_uri']);
$verifier = md5($app['secret'] . local_user()); $verifier = md5($app['secret'] . local_user());
Config::set("oauth", $verifier, local_user()); DI::config()->set("oauth", $verifier, local_user());
if ($consumer->callback_url != null) { if ($consumer->callback_url != null) {
$params = $request->get_parameters(); $params = $request->get_parameters();

View file

@ -348,7 +348,7 @@ class Addon
*/ */
public static function saveEnabledList() public static function saveEnabledList()
{ {
return Config::set('system', 'addon', implode(',', self::$addons)); return DI::config()->set('system', 'addon', implode(',', self::$addons));
} }
/** /**

View file

@ -19,22 +19,6 @@ use Friendica\DI;
*/ */
class Config class Config
{ {
/**
* Stores a config value ($value) in the category ($cat) under the key ($key)
*
* Note: Please do not store booleans - convert to 0/1 integer values!
*
* @param string $cat The category of the configuration value
* @param string $key The configuration key to set
* @param mixed $value The value to store
*
* @return bool Operation success
*/
public static function set($cat, $key, $value)
{
return DI::config()->set($cat, $key, $value);
}
/** /**
* Deletes the given key from the system configuration. * Deletes the given key from the system configuration.
* *

View file

@ -36,7 +36,7 @@ class Theme
public static function setAllowedList(array $allowed_themes) public static function setAllowedList(array $allowed_themes)
{ {
Config::set('system', 'allowed_themes', implode(',', array_unique($allowed_themes))); DI::config()->set('system', 'allowed_themes', implode(',', array_unique($allowed_themes)));
} }
/** /**

View file

@ -36,7 +36,7 @@ class Update
$build = DI::config()->get('system', 'build'); $build = DI::config()->get('system', 'build');
if (empty($build)) { if (empty($build)) {
Config::set('system', 'build', DB_UPDATE_VERSION - 1); DI::config()->set('system', 'build', DB_UPDATE_VERSION - 1);
$build = DB_UPDATE_VERSION - 1; $build = DB_UPDATE_VERSION - 1;
} }
@ -81,7 +81,7 @@ class Update
if (empty($build) || ($build > DB_UPDATE_VERSION)) { if (empty($build) || ($build > DB_UPDATE_VERSION)) {
$build = DB_UPDATE_VERSION - 1; $build = DB_UPDATE_VERSION - 1;
Config::set('system', 'build', $build); DI::config()->set('system', 'build', $build);
} }
if ($build != DB_UPDATE_VERSION || $force) { if ($build != DB_UPDATE_VERSION || $force) {
@ -110,7 +110,7 @@ class Update
for ($x = $stored + 1; $x <= $current; $x++) { for ($x = $stored + 1; $x <= $current; $x++) {
$r = self::runUpdateFunction($x, 'pre_update'); $r = self::runUpdateFunction($x, 'pre_update');
if (!$r) { if (!$r) {
Config::set('system', 'update', Update::FAILED); DI::config()->set('system', 'update', Update::FAILED);
DI::lock()->release('dbupdate'); DI::lock()->release('dbupdate');
return $r; return $r;
} }
@ -126,12 +126,12 @@ class Update
); );
} }
Logger::error('Update ERROR.', ['from' => $stored, 'to' => $current, 'retval' => $retval]); Logger::error('Update ERROR.', ['from' => $stored, 'to' => $current, 'retval' => $retval]);
Config::set('system', 'update', Update::FAILED); DI::config()->set('system', 'update', Update::FAILED);
DI::lock()->release('dbupdate'); DI::lock()->release('dbupdate');
return $retval; return $retval;
} else { } else {
Config::set('database', 'last_successful_update', $current); DI::config()->set('database', 'last_successful_update', $current);
Config::set('database', 'last_successful_update_time', time()); DI::config()->set('database', 'last_successful_update_time', time());
Logger::info('Update finished.', ['from' => $stored, 'to' => $current]); Logger::info('Update finished.', ['from' => $stored, 'to' => $current]);
} }
@ -139,7 +139,7 @@ class Update
for ($x = $stored + 1; $x <= $current; $x++) { for ($x = $stored + 1; $x <= $current; $x++) {
$r = self::runUpdateFunction($x, 'update'); $r = self::runUpdateFunction($x, 'update');
if (!$r) { if (!$r) {
Config::set('system', 'update', Update::FAILED); DI::config()->set('system', 'update', Update::FAILED);
DI::lock()->release('dbupdate'); DI::lock()->release('dbupdate');
return $r; return $r;
} }
@ -150,7 +150,7 @@ class Update
self::updateSuccessfull($stored, $current); self::updateSuccessfull($stored, $current);
} }
Config::set('system', 'update', Update::SUCCESS); DI::config()->set('system', 'update', Update::SUCCESS);
DI::lock()->release('dbupdate'); DI::lock()->release('dbupdate');
} }
} }
@ -197,11 +197,11 @@ class Update
DI::lock()->release('dbupdate_function'); DI::lock()->release('dbupdate_function');
return false; return false;
} else { } else {
Config::set('database', 'last_successful_update_function', $funcname); DI::config()->set('database', 'last_successful_update_function', $funcname);
Config::set('database', 'last_successful_update_function_time', time()); DI::config()->set('database', 'last_successful_update_function_time', time());
if ($prefix == 'update') { if ($prefix == 'update') {
Config::set('system', 'build', $x); DI::config()->set('system', 'build', $x);
} }
DI::lock()->release('dbupdate_function'); DI::lock()->release('dbupdate_function');
@ -212,11 +212,11 @@ class Update
} else { } else {
Logger::info('Update function skipped.', ['function' => $funcname]); Logger::info('Update function skipped.', ['function' => $funcname]);
Config::set('database', 'last_successful_update_function', $funcname); DI::config()->set('database', 'last_successful_update_function', $funcname);
Config::set('database', 'last_successful_update_function_time', time()); DI::config()->set('database', 'last_successful_update_function_time', time());
if ($prefix == 'update') { if ($prefix == 'update') {
Config::set('system', 'build', $x); DI::config()->set('system', 'build', $x);
} }
return true; return true;

View file

@ -65,7 +65,7 @@ class Worker
// Kill stale processes every 5 minutes // Kill stale processes every 5 minutes
$last_cleanup = DI::config()->get('system', 'worker_last_cleaned', 0); $last_cleanup = DI::config()->get('system', 'worker_last_cleaned', 0);
if (time() > ($last_cleanup + 300)) { if (time() > ($last_cleanup + 300)) {
Config::set('system', 'worker_last_cleaned', time()); DI::config()->set('system', 'worker_last_cleaned', time());
self::killStaleWorkers(); self::killStaleWorkers();
} }
@ -297,7 +297,7 @@ class Worker
$stamp = (float)microtime(true); $stamp = (float)microtime(true);
$condition = ["`id` = ? AND `next_try` < ?", $queue['id'], DateTimeFormat::utcNow()]; $condition = ["`id` = ? AND `next_try` < ?", $queue['id'], DateTimeFormat::utcNow()];
if (DBA::update('workerqueue', ['done' => true], $condition)) { if (DBA::update('workerqueue', ['done' => true], $condition)) {
Config::set('system', 'last_worker_execution', DateTimeFormat::utcNow()); DI::config()->set('system', 'last_worker_execution', DateTimeFormat::utcNow());
} }
self::$db_duration = (microtime(true) - $stamp); self::$db_duration = (microtime(true) - $stamp);
self::$db_duration_write += (microtime(true) - $stamp); self::$db_duration_write += (microtime(true) - $stamp);
@ -343,7 +343,7 @@ class Worker
$stamp = (float)microtime(true); $stamp = (float)microtime(true);
if (DBA::update('workerqueue', ['done' => true], ['id' => $queue["id"]])) { if (DBA::update('workerqueue', ['done' => true], ['id' => $queue["id"]])) {
Config::set('system', 'last_worker_execution', DateTimeFormat::utcNow()); DI::config()->set('system', 'last_worker_execution', DateTimeFormat::utcNow());
} }
self::$db_duration = (microtime(true) - $stamp); self::$db_duration = (microtime(true) - $stamp);
self::$db_duration_write += (microtime(true) - $stamp); self::$db_duration_write += (microtime(true) - $stamp);
@ -1004,7 +1004,7 @@ class Worker
return; return;
} }
Config::set("system", "worker_started", time()); DI::config()->set("system", "worker_started", time());
// Do we have enough running workers? Then we quit here. // Do we have enough running workers? Then we quit here.
if (self::tooMuchWorkers()) { if (self::tooMuchWorkers()) {

View file

@ -260,8 +260,8 @@ class DBStructure
public static function update($basePath, $verbose, $action, $install = false, array $tables = null, array $definition = null) public static function update($basePath, $verbose, $action, $install = false, array $tables = null, array $definition = null)
{ {
if ($action && !$install) { if ($action && !$install) {
Config::set('system', 'maintenance', 1); DI::config()->set('system', 'maintenance', 1);
Config::set('system', 'maintenance_reason', DI::l10n()->t('%s: Database update', DateTimeFormat::utcNow() . ' ' . date('e'))); DI::config()->set('system', 'maintenance_reason', DI::l10n()->t('%s: Database update', DateTimeFormat::utcNow() . ' ' . date('e')));
} }
$errors = ''; $errors = '';
@ -522,7 +522,7 @@ class DBStructure
if ($action) { if ($action) {
if (!$install) { if (!$install) {
Config::set('system', 'maintenance_reason', DI::l10n()->t('%s: updating %s table.', DateTimeFormat::utcNow() . ' ' . date('e'), $name)); DI::config()->set('system', 'maintenance_reason', DI::l10n()->t('%s: updating %s table.', DateTimeFormat::utcNow() . ' ' . date('e'), $name));
} }
// Ensure index conversion to unique removes duplicates // Ensure index conversion to unique removes duplicates
@ -574,13 +574,13 @@ class DBStructure
} }
if ($action && !$install) { if ($action && !$install) {
Config::set('system', 'maintenance', 0); DI::config()->set('system', 'maintenance', 0);
Config::set('system', 'maintenance_reason', ''); DI::config()->set('system', 'maintenance_reason', '');
if ($errors) { if ($errors) {
Config::set('system', 'dbupdate', self::UPDATE_FAILED); DI::config()->set('system', 'dbupdate', self::UPDATE_FAILED);
} else { } else {
Config::set('system', 'dbupdate', self::UPDATE_SUCCESSFUL); DI::config()->set('system', 'dbupdate', self::UPDATE_SUCCESSFUL);
} }
} }

View file

@ -67,7 +67,7 @@ class PostUpdate
if (!$end_id) { if (!$end_id) {
$r = q("SELECT `id` FROM `item` WHERE `uid` != 0 ORDER BY `id` DESC LIMIT 1"); $r = q("SELECT `id` FROM `item` WHERE `uid` != 0 ORDER BY `id` DESC LIMIT 1");
if ($r) { if ($r) {
Config::set("system", "post_update_1194_end", $r[0]["id"]); DI::config()->set("system", "post_update_1194_end", $r[0]["id"]);
$end_id = DI::config()->get("system", "post_update_1194_end"); $end_id = DI::config()->get("system", "post_update_1194_end");
} }
} }
@ -90,11 +90,11 @@ class PostUpdate
intval($start_id), intval($end_id), intval($start_id), intval($end_id),
DBA::escape(Protocol::DFRN), DBA::escape(Protocol::DIASPORA), DBA::escape(Protocol::OSTATUS)); DBA::escape(Protocol::DFRN), DBA::escape(Protocol::DIASPORA), DBA::escape(Protocol::OSTATUS));
if (!$r) { if (!$r) {
Config::set("system", "post_update_version", 1194); DI::config()->set("system", "post_update_version", 1194);
Logger::log("Update is done", Logger::DEBUG); Logger::log("Update is done", Logger::DEBUG);
return true; return true;
} else { } else {
Config::set("system", "post_update_1194_start", $r[0]["id"]); DI::config()->set("system", "post_update_1194_start", $r[0]["id"]);
$start_id = DI::config()->get("system", "post_update_1194_start"); $start_id = DI::config()->get("system", "post_update_1194_start");
} }
@ -147,7 +147,7 @@ class PostUpdate
} }
} }
Config::set("system", "post_update_version", 1206); DI::config()->set("system", "post_update_version", 1206);
Logger::log("Done", Logger::DEBUG); Logger::log("Done", Logger::DEBUG);
return true; return true;
} }
@ -235,7 +235,7 @@ class PostUpdate
} }
DBA::close($items); DBA::close($items);
Config::set("system", "post_update_version_1279_id", $id); DI::config()->set("system", "post_update_version_1279_id", $id);
Logger::log("Processed rows: " . $rows . " - last processed item: " . $id, Logger::DEBUG); Logger::log("Processed rows: " . $rows . " - last processed item: " . $id, Logger::DEBUG);
@ -254,7 +254,7 @@ class PostUpdate
DBA::update('item', $fields, $condition); DBA::update('item', $fields, $condition);
} }
Config::set("system", "post_update_version", 1279); DI::config()->set("system", "post_update_version", 1279);
Logger::log("Done", Logger::DEBUG); Logger::log("Done", Logger::DEBUG);
return true; return true;
} }
@ -369,7 +369,7 @@ class PostUpdate
} }
DBA::close($items); DBA::close($items);
Config::set("system", "post_update_version_1281_id", $id); DI::config()->set("system", "post_update_version_1281_id", $id);
Logger::log("Processed rows: " . $rows . " - last processed item: " . $id, Logger::DEBUG); Logger::log("Processed rows: " . $rows . " - last processed item: " . $id, Logger::DEBUG);
@ -380,7 +380,7 @@ class PostUpdate
Logger::log("Updating item-uri in item-content", Logger::DEBUG); Logger::log("Updating item-uri in item-content", Logger::DEBUG);
DBA::e("UPDATE `item-content` INNER JOIN `item-uri` ON `item-uri`.`uri` = `item-content`.`uri` SET `item-content`.`uri-id` = `item-uri`.`id` WHERE `item-content`.`uri-id` IS NULL"); DBA::e("UPDATE `item-content` INNER JOIN `item-uri` ON `item-uri`.`uri` = `item-content`.`uri` SET `item-content`.`uri-id` = `item-uri`.`id` WHERE `item-content`.`uri-id` IS NULL");
Config::set("system", "post_update_version", 1281); DI::config()->set("system", "post_update_version", 1281);
Logger::log("Done", Logger::DEBUG); Logger::log("Done", Logger::DEBUG);
return true; return true;
} }
@ -417,7 +417,7 @@ class PostUpdate
Logger::info('Processed rows: ' . DBA::affectedRows()); Logger::info('Processed rows: ' . DBA::affectedRows());
Config::set('system', 'post_update_version', 1297); DI::config()->set('system', 'post_update_version', 1297);
Logger::info('Done'); Logger::info('Done');
@ -451,7 +451,7 @@ class PostUpdate
} }
DBA::close($contact); DBA::close($contact);
Config::set('system', 'post_update_version', 1322); DI::config()->set('system', 'post_update_version', 1322);
Logger::info('Done'); Logger::info('Done');
@ -495,12 +495,12 @@ class PostUpdate
} }
DBA::close($items); DBA::close($items);
Config::set('system', 'post_update_version_1329_id', $id); DI::config()->set('system', 'post_update_version_1329_id', $id);
Logger::info('Processed', ['rows' => $rows, 'last' => $id]); Logger::info('Processed', ['rows' => $rows, 'last' => $id]);
if ($start_id == $id) { if ($start_id == $id) {
Config::set('system', 'post_update_version', 1329); DI::config()->set('system', 'post_update_version', 1329);
Logger::info('Done'); Logger::info('Done');
return true; return true;
} }

View file

@ -1429,6 +1429,6 @@ class GServer
} }
} }
Config::set('poco', 'last_federation_discovery', time()); DI::config()->set('poco', 'last_federation_discovery', time());
} }
} }

View file

@ -27,7 +27,7 @@ class Server extends BaseAdminModule
'domain' => Strings::escapeTags(trim($_POST['newentry_domain'])), 'domain' => Strings::escapeTags(trim($_POST['newentry_domain'])),
'reason' => Strings::escapeTags(trim($_POST['newentry_reason'])) 'reason' => Strings::escapeTags(trim($_POST['newentry_reason']))
]; ];
Config::set('system', 'blocklist', $blocklist); DI::config()->set('system', 'blocklist', $blocklist);
info(DI::l10n()->t('Server domain pattern added to blocklist.') . EOL); info(DI::l10n()->t('Server domain pattern added to blocklist.') . EOL);
} else { } else {
// Edit the entries from blocklist // Edit the entries from blocklist
@ -43,7 +43,7 @@ class Server extends BaseAdminModule
]; ];
} }
} }
Config::set('system', 'blocklist', $blocklist); DI::config()->set('system', 'blocklist', $blocklist);
info(DI::l10n()->t('Site blocklist updated.') . EOL); info(DI::l10n()->t('Site blocklist updated.') . EOL);
} }

View file

@ -24,10 +24,10 @@ class DBSync extends BaseAdminModule
// @TODO: Replace with parameter from router // @TODO: Replace with parameter from router
$update = intval($a->argv[3]); $update = intval($a->argv[3]);
if ($update) { if ($update) {
Config::set('database', 'update_' . $update, 'success'); DI::config()->set('database', 'update_' . $update, 'success');
$curr = DI::config()->get('system', 'build'); $curr = DI::config()->get('system', 'build');
if (intval($curr) == $update) { if (intval($curr) == $update) {
Config::set('system', 'build', intval($curr) + 1); DI::config()->set('system', 'build', intval($curr) + 1);
} }
info(DI::l10n()->t('Update has been marked successful') . EOL); info(DI::l10n()->t('Update has been marked successful') . EOL);
} }
@ -40,8 +40,8 @@ class DBSync extends BaseAdminModule
$retval = DBStructure::update($a->getBasePath(), false, true); $retval = DBStructure::update($a->getBasePath(), false, true);
if ($retval === '') { if ($retval === '') {
$o .= DI::l10n()->t("Database structure update %s was successfully applied.", DB_UPDATE_VERSION) . "<br />"; $o .= DI::l10n()->t("Database structure update %s was successfully applied.", DB_UPDATE_VERSION) . "<br />";
Config::set('database', 'last_successful_update', DB_UPDATE_VERSION); DI::config()->set('database', 'last_successful_update', DB_UPDATE_VERSION);
Config::set('database', 'last_successful_update_time', time()); DI::config()->set('database', 'last_successful_update_time', time());
} else { } else {
$o .= DI::l10n()->t("Executing of database structure update %s failed with error: %s", DB_UPDATE_VERSION, $retval) . "<br />"; $o .= DI::l10n()->t("Executing of database structure update %s failed with error: %s", DB_UPDATE_VERSION, $retval) . "<br />";
} }
@ -63,13 +63,13 @@ class DBSync extends BaseAdminModule
$o .= DI::l10n()->t("Executing %s failed with error: %s", $func, $retval); $o .= DI::l10n()->t("Executing %s failed with error: %s", $func, $retval);
} elseif ($retval === Update::SUCCESS) { } elseif ($retval === Update::SUCCESS) {
$o .= DI::l10n()->t('Update %s was successfully applied.', $func); $o .= DI::l10n()->t('Update %s was successfully applied.', $func);
Config::set('database', $func, 'success'); DI::config()->set('database', $func, 'success');
} else { } else {
$o .= DI::l10n()->t('Update %s did not return a status. Unknown if it succeeded.', $func); $o .= DI::l10n()->t('Update %s did not return a status. Unknown if it succeeded.', $func);
} }
} else { } else {
$o .= DI::l10n()->t('There was no additional update function %s that needed to be called.', $func) . "<br />"; $o .= DI::l10n()->t('There was no additional update function %s that needed to be called.', $func) . "<br />";
Config::set('database', $func, 'success'); DI::config()->set('database', $func, 'success');
} }
return $o; return $o;

View file

@ -29,10 +29,10 @@ class Features extends BaseAdminModule
} else { } else {
$val = 0; $val = 0;
} }
Config::set('feature', $feature, $val); DI::config()->set('feature', $feature, $val);
if (!empty($_POST[$featurelock])) { if (!empty($_POST[$featurelock])) {
Config::set('feature_lock', $feature, $val); DI::config()->set('feature_lock', $feature, $val);
} else { } else {
Config::delete('feature_lock', $feature); Config::delete('feature_lock', $feature);
} }

View file

@ -28,9 +28,9 @@ class Settings extends BaseAdminModule
return; return;
} }
Config::set('system', 'logfile', $logfile); DI::config()->set('system', 'logfile', $logfile);
Config::set('system', 'debugging', $debugging); DI::config()->set('system', 'debugging', $debugging);
Config::set('system', 'loglevel', $loglevel); DI::config()->set('system', 'loglevel', $loglevel);
} }
info(DI::l10n()->t("Log settings updated.")); info(DI::l10n()->t("Log settings updated."));

View file

@ -93,7 +93,7 @@ class Site extends BaseAdminModule
update_table($a, "gcontact", ['connect', 'addr'], $old_host, $new_host); update_table($a, "gcontact", ['connect', 'addr'], $old_host, $new_host);
// update config // update config
Config::set('system', 'url', $new_url); DI::config()->set('system', 'url', $new_url);
DI::baseUrl()->saveByURL($new_url); DI::baseUrl()->saveByURL($new_url);
// send relocate // send relocate
@ -232,7 +232,7 @@ class Site extends BaseAdminModule
// Has the directory url changed? If yes, then resubmit the existing profiles there // Has the directory url changed? If yes, then resubmit the existing profiles there
if ($global_directory != DI::config()->get('system', 'directory') && ($global_directory != '')) { if ($global_directory != DI::config()->get('system', 'directory') && ($global_directory != '')) {
Config::set('system', 'directory', $global_directory); DI::config()->set('system', 'directory', $global_directory);
Worker::add(PRIORITY_LOW, 'Directory'); Worker::add(PRIORITY_LOW, 'Directory');
} }
@ -278,129 +278,129 @@ class Site extends BaseAdminModule
); );
} }
} }
Config::set('system', 'ssl_policy' , $ssl_policy); DI::config()->set('system', 'ssl_policy' , $ssl_policy);
Config::set('system', 'maxloadavg' , $maxloadavg); DI::config()->set('system', 'maxloadavg' , $maxloadavg);
Config::set('system', 'maxloadavg_frontend' , $maxloadavg_frontend); DI::config()->set('system', 'maxloadavg_frontend' , $maxloadavg_frontend);
Config::set('system', 'min_memory' , $min_memory); DI::config()->set('system', 'min_memory' , $min_memory);
Config::set('system', 'optimize_max_tablesize', $optimize_max_tablesize); DI::config()->set('system', 'optimize_max_tablesize', $optimize_max_tablesize);
Config::set('system', 'optimize_fragmentation', $optimize_fragmentation); DI::config()->set('system', 'optimize_fragmentation', $optimize_fragmentation);
Config::set('system', 'poco_completion' , $poco_completion); DI::config()->set('system', 'poco_completion' , $poco_completion);
Config::set('system', 'poco_requery_days' , $poco_requery_days); DI::config()->set('system', 'poco_requery_days' , $poco_requery_days);
Config::set('system', 'poco_discovery' , $poco_discovery); DI::config()->set('system', 'poco_discovery' , $poco_discovery);
Config::set('system', 'poco_discovery_since' , $poco_discovery_since); DI::config()->set('system', 'poco_discovery_since' , $poco_discovery_since);
Config::set('system', 'poco_local_search' , $poco_local_search); DI::config()->set('system', 'poco_local_search' , $poco_local_search);
Config::set('system', 'nodeinfo' , $nodeinfo); DI::config()->set('system', 'nodeinfo' , $nodeinfo);
Config::set('config', 'sitename' , $sitename); DI::config()->set('config', 'sitename' , $sitename);
Config::set('config', 'sender_email' , $sender_email); DI::config()->set('config', 'sender_email' , $sender_email);
Config::set('system', 'suppress_tags' , $suppress_tags); DI::config()->set('system', 'suppress_tags' , $suppress_tags);
Config::set('system', 'shortcut_icon' , $shortcut_icon); DI::config()->set('system', 'shortcut_icon' , $shortcut_icon);
Config::set('system', 'touch_icon' , $touch_icon); DI::config()->set('system', 'touch_icon' , $touch_icon);
if ($banner == "") { if ($banner == "") {
Config::delete('system', 'banner'); Config::delete('system', 'banner');
} else { } else {
Config::set('system', 'banner', $banner); DI::config()->set('system', 'banner', $banner);
} }
if (empty($additional_info)) { if (empty($additional_info)) {
Config::delete('config', 'info'); Config::delete('config', 'info');
} else { } else {
Config::set('config', 'info', $additional_info); DI::config()->set('config', 'info', $additional_info);
} }
Config::set('system', 'language', $language); DI::config()->set('system', 'language', $language);
Config::set('system', 'theme', $theme); DI::config()->set('system', 'theme', $theme);
Theme::install($theme); Theme::install($theme);
if ($theme_mobile == '---') { if ($theme_mobile == '---') {
Config::delete('system', 'mobile-theme'); Config::delete('system', 'mobile-theme');
} else { } else {
Config::set('system', 'mobile-theme', $theme_mobile); DI::config()->set('system', 'mobile-theme', $theme_mobile);
} }
if ($singleuser == '---') { if ($singleuser == '---') {
Config::delete('system', 'singleuser'); Config::delete('system', 'singleuser');
} else { } else {
Config::set('system', 'singleuser', $singleuser); DI::config()->set('system', 'singleuser', $singleuser);
} }
Config::set('system', 'maximagesize' , $maximagesize); DI::config()->set('system', 'maximagesize' , $maximagesize);
Config::set('system', 'max_image_length' , $maximagelength); DI::config()->set('system', 'max_image_length' , $maximagelength);
Config::set('system', 'jpeg_quality' , $jpegimagequality); DI::config()->set('system', 'jpeg_quality' , $jpegimagequality);
Config::set('config', 'register_policy' , $register_policy); DI::config()->set('config', 'register_policy' , $register_policy);
Config::set('system', 'max_daily_registrations', $daily_registrations); DI::config()->set('system', 'max_daily_registrations', $daily_registrations);
Config::set('system', 'account_abandon_days' , $abandon_days); DI::config()->set('system', 'account_abandon_days' , $abandon_days);
Config::set('config', 'register_text' , $register_text); DI::config()->set('config', 'register_text' , $register_text);
Config::set('system', 'allowed_sites' , $allowed_sites); DI::config()->set('system', 'allowed_sites' , $allowed_sites);
Config::set('system', 'allowed_email' , $allowed_email); DI::config()->set('system', 'allowed_email' , $allowed_email);
Config::set('system', 'forbidden_nicknames' , $forbidden_nicknames); DI::config()->set('system', 'forbidden_nicknames' , $forbidden_nicknames);
Config::set('system', 'no_oembed_rich_content' , $no_oembed_rich_content); DI::config()->set('system', 'no_oembed_rich_content' , $no_oembed_rich_content);
Config::set('system', 'allowed_oembed' , $allowed_oembed); DI::config()->set('system', 'allowed_oembed' , $allowed_oembed);
Config::set('system', 'block_public' , $block_public); DI::config()->set('system', 'block_public' , $block_public);
Config::set('system', 'publish_all' , $force_publish); DI::config()->set('system', 'publish_all' , $force_publish);
Config::set('system', 'newuser_private' , $newuser_private); DI::config()->set('system', 'newuser_private' , $newuser_private);
Config::set('system', 'enotify_no_content' , $enotify_no_content); DI::config()->set('system', 'enotify_no_content' , $enotify_no_content);
Config::set('system', 'disable_embedded' , $disable_embedded); DI::config()->set('system', 'disable_embedded' , $disable_embedded);
Config::set('system', 'allow_users_remote_self', $allow_users_remote_self); DI::config()->set('system', 'allow_users_remote_self', $allow_users_remote_self);
Config::set('system', 'explicit_content' , $explicit_content); DI::config()->set('system', 'explicit_content' , $explicit_content);
Config::set('system', 'check_new_version_url' , $check_new_version_url); DI::config()->set('system', 'check_new_version_url' , $check_new_version_url);
Config::set('system', 'block_extended_register', $no_multi_reg); DI::config()->set('system', 'block_extended_register', $no_multi_reg);
Config::set('system', 'no_openid' , $no_openid); DI::config()->set('system', 'no_openid' , $no_openid);
Config::set('system', 'no_regfullname' , $no_regfullname); DI::config()->set('system', 'no_regfullname' , $no_regfullname);
Config::set('system', 'community_page_style' , $community_page_style); DI::config()->set('system', 'community_page_style' , $community_page_style);
Config::set('system', 'max_author_posts_community_page', $max_author_posts_community_page); DI::config()->set('system', 'max_author_posts_community_page', $max_author_posts_community_page);
Config::set('system', 'verifyssl' , $verifyssl); DI::config()->set('system', 'verifyssl' , $verifyssl);
Config::set('system', 'proxyuser' , $proxyuser); DI::config()->set('system', 'proxyuser' , $proxyuser);
Config::set('system', 'proxy' , $proxy); DI::config()->set('system', 'proxy' , $proxy);
Config::set('system', 'curl_timeout' , $timeout); DI::config()->set('system', 'curl_timeout' , $timeout);
Config::set('system', 'dfrn_only' , $dfrn_only); DI::config()->set('system', 'dfrn_only' , $dfrn_only);
Config::set('system', 'ostatus_disabled' , $ostatus_disabled); DI::config()->set('system', 'ostatus_disabled' , $ostatus_disabled);
Config::set('system', 'diaspora_enabled' , $diaspora_enabled); DI::config()->set('system', 'diaspora_enabled' , $diaspora_enabled);
Config::set('config', 'private_addons' , $private_addons); DI::config()->set('config', 'private_addons' , $private_addons);
Config::set('system', 'force_ssl' , $force_ssl); DI::config()->set('system', 'force_ssl' , $force_ssl);
Config::set('system', 'hide_help' , $hide_help); DI::config()->set('system', 'hide_help' , $hide_help);
Config::set('system', 'dbclean' , $dbclean); DI::config()->set('system', 'dbclean' , $dbclean);
Config::set('system', 'dbclean-expire-days' , $dbclean_expire_days); DI::config()->set('system', 'dbclean-expire-days' , $dbclean_expire_days);
Config::set('system', 'dbclean_expire_conversation', $dbclean_expire_conv); DI::config()->set('system', 'dbclean_expire_conversation', $dbclean_expire_conv);
if ($dbclean_unclaimed == 0) { if ($dbclean_unclaimed == 0) {
$dbclean_unclaimed = $dbclean_expire_days; $dbclean_unclaimed = $dbclean_expire_days;
} }
Config::set('system', 'dbclean-expire-unclaimed', $dbclean_unclaimed); DI::config()->set('system', 'dbclean-expire-unclaimed', $dbclean_unclaimed);
if ($itemcache != '') { if ($itemcache != '') {
$itemcache = BasePath::getRealPath($itemcache); $itemcache = BasePath::getRealPath($itemcache);
} }
Config::set('system', 'itemcache', $itemcache); DI::config()->set('system', 'itemcache', $itemcache);
Config::set('system', 'itemcache_duration', $itemcache_duration); DI::config()->set('system', 'itemcache_duration', $itemcache_duration);
Config::set('system', 'max_comments', $max_comments); DI::config()->set('system', 'max_comments', $max_comments);
if ($temppath != '') { if ($temppath != '') {
$temppath = BasePath::getRealPath($temppath); $temppath = BasePath::getRealPath($temppath);
} }
Config::set('system', 'temppath', $temppath); DI::config()->set('system', 'temppath', $temppath);
Config::set('system', 'proxy_disabled' , $proxy_disabled); DI::config()->set('system', 'proxy_disabled' , $proxy_disabled);
Config::set('system', 'only_tag_search' , $only_tag_search); DI::config()->set('system', 'only_tag_search' , $only_tag_search);
Config::set('system', 'worker_queues' , $worker_queues); DI::config()->set('system', 'worker_queues' , $worker_queues);
Config::set('system', 'worker_dont_fork' , $worker_dont_fork); DI::config()->set('system', 'worker_dont_fork' , $worker_dont_fork);
Config::set('system', 'worker_fastlane' , $worker_fastlane); DI::config()->set('system', 'worker_fastlane' , $worker_fastlane);
Config::set('system', 'frontend_worker' , $worker_frontend); DI::config()->set('system', 'frontend_worker' , $worker_frontend);
Config::set('system', 'relay_directly' , $relay_directly); DI::config()->set('system', 'relay_directly' , $relay_directly);
Config::set('system', 'relay_server' , $relay_server); DI::config()->set('system', 'relay_server' , $relay_server);
Config::set('system', 'relay_subscribe' , $relay_subscribe); DI::config()->set('system', 'relay_subscribe' , $relay_subscribe);
Config::set('system', 'relay_scope' , $relay_scope); DI::config()->set('system', 'relay_scope' , $relay_scope);
Config::set('system', 'relay_server_tags', $relay_server_tags); DI::config()->set('system', 'relay_server_tags', $relay_server_tags);
Config::set('system', 'relay_user_tags' , $relay_user_tags); DI::config()->set('system', 'relay_user_tags' , $relay_user_tags);
Config::set('system', 'rino_encrypt' , $rino); DI::config()->set('system', 'rino_encrypt' , $rino);
info(DI::l10n()->t('Site settings updated.') . EOL); info(DI::l10n()->t('Site settings updated.') . EOL);
@ -416,7 +416,7 @@ class Site extends BaseAdminModule
if (strlen(DI::config()->get('system', 'directory_submit_url')) && if (strlen(DI::config()->get('system', 'directory_submit_url')) &&
!strlen(DI::config()->get('system', 'directory'))) { !strlen(DI::config()->get('system', 'directory'))) {
Config::set('system', 'directory', dirname(DI::config()->get('system', 'directory_submit_url'))); DI::config()->set('system', 'directory', dirname(DI::config()->get('system', 'directory_submit_url')));
Config::delete('system', 'directory_submit_url'); Config::delete('system', 'directory_submit_url');
} }

View file

@ -115,7 +115,7 @@ class Summary extends BaseAdminModule
$confBasepath = $configCache->get('system', 'basepath'); $confBasepath = $configCache->get('system', 'basepath');
$currBasepath = DI::config()->get('system', 'basepath'); $currBasepath = DI::config()->get('system', 'basepath');
if ($confBasepath !== $currBasepath || !is_dir($currBasepath)) { if ($confBasepath !== $currBasepath || !is_dir($currBasepath)) {
if (is_dir($confBasepath) && Config::set('system', 'basepath', $confBasepath)) { if (is_dir($confBasepath) && DI::config()->set('system', 'basepath', $confBasepath)) {
DI::logger()->info('Friendica\'s system.basepath was updated successfully.', [ DI::logger()->info('Friendica\'s system.basepath was updated successfully.', [
'from' => $currBasepath, 'from' => $currBasepath,
'to' => $confBasepath, 'to' => $confBasepath,

View file

@ -23,9 +23,9 @@ class Tos extends BaseAdminModule
$displayprivstatement = !empty($_POST['displayprivstatement']); $displayprivstatement = !empty($_POST['displayprivstatement']);
$tostext = (!empty($_POST['tostext']) ? strip_tags(trim($_POST['tostext'])) : ''); $tostext = (!empty($_POST['tostext']) ? strip_tags(trim($_POST['tostext'])) : '');
Config::set('system', 'tosdisplay', $displaytos); DI::config()->set('system', 'tosdisplay', $displaytos);
Config::set('system', 'tosprivstatement', $displayprivstatement); DI::config()->set('system', 'tosprivstatement', $displayprivstatement);
Config::set('system', 'tostext', $tostext); DI::config()->set('system', 'tostext', $tostext);
info(DI::l10n()->t('The Terms of Service settings have been updated.')); info(DI::l10n()->t('The Terms of Service settings have been updated.'));

View file

@ -492,8 +492,8 @@ class DFRN
$pubkey = DI::config()->get('system', 'site_pubkey'); $pubkey = DI::config()->get('system', 'site_pubkey');
if (! $pubkey) { if (! $pubkey) {
$res = Crypto::newKeypair(1024); $res = Crypto::newKeypair(1024);
Config::set('system', 'site_prvkey', $res['prvkey']); DI::config()->set('system', 'site_prvkey', $res['prvkey']);
Config::set('system', 'site_pubkey', $res['pubkey']); DI::config()->set('system', 'site_pubkey', $res['pubkey']);
} }
$rp = q( $rp = q(

View file

@ -43,7 +43,7 @@ class CheckVersion
$gitversion = DBA::escape(trim(Network::fetchUrl($checked_url))); $gitversion = DBA::escape(trim(Network::fetchUrl($checked_url)));
Logger::log("Upstream VERSION is: ".$gitversion, Logger::DEBUG); Logger::log("Upstream VERSION is: ".$gitversion, Logger::DEBUG);
Config::set('system', 'git_friendica_version', $gitversion); DI::config()->set('system', 'git_friendica_version', $gitversion);
Logger::log('checkversion: end'); Logger::log('checkversion: end');

View file

@ -86,7 +86,7 @@ class Cron
self::checkdeletedContacts(); self::checkdeletedContacts();
Config::set('system', 'last_expire_day', $d2); DI::config()->set('system', 'last_expire_day', $d2);
} }
// Hourly cron calls // Hourly cron calls
@ -100,7 +100,7 @@ class Cron
DBA::e("OPTIMIZE TABLE `workerqueue`"); DBA::e("OPTIMIZE TABLE `workerqueue`");
} }
Config::set('system', 'last_cron_hourly', time()); DI::config()->set('system', 'last_cron_hourly', time());
} }
// Ensure to have a .htaccess file. // Ensure to have a .htaccess file.
@ -118,7 +118,7 @@ class Cron
Logger::log('cron: end'); Logger::log('cron: end');
Config::set('system', 'last_cron', time()); DI::config()->set('system', 'last_cron', time());
return; return;
} }

View file

@ -226,7 +226,7 @@ class CronJobs
} }
} }
Config::set('system', 'cache_last_cleared', time()); DI::config()->set('system', 'cache_last_cleared', time());
} }
/** /**

View file

@ -98,7 +98,7 @@ class DBClean {
DBA::close($r); DBA::close($r);
Logger::log("Done deleting ".$count." old global item entries from item table without user copy. Last ID: ".$last_id); Logger::log("Done deleting ".$count." old global item entries from item table without user copy. Last ID: ".$last_id);
Config::set('system', 'dbclean-last-id-1', $last_id); DI::config()->set('system', 'dbclean-last-id-1', $last_id);
} elseif ($stage == 2) { } elseif ($stage == 2) {
$last_id = DI::config()->get('system', 'dbclean-last-id-2', 0); $last_id = DI::config()->get('system', 'dbclean-last-id-2', 0);
@ -120,10 +120,10 @@ class DBClean {
DBA::close($r); DBA::close($r);
Logger::log("Done deleting ".$count." items without parents. Last ID: ".$last_id); Logger::log("Done deleting ".$count." items without parents. Last ID: ".$last_id);
Config::set('system', 'dbclean-last-id-2', $last_id); DI::config()->set('system', 'dbclean-last-id-2', $last_id);
if ($count < $limit) { if ($count < $limit) {
Config::set('system', 'finished-dbclean-2', true); DI::config()->set('system', 'finished-dbclean-2', true);
} }
} elseif ($stage == 3) { } elseif ($stage == 3) {
$last_id = DI::config()->get('system', 'dbclean-last-id-3', 0); $last_id = DI::config()->get('system', 'dbclean-last-id-3', 0);
@ -146,10 +146,10 @@ class DBClean {
DBA::close($r); DBA::close($r);
Logger::log("Done deleting ".$count." orphaned data from thread table. Last ID: ".$last_id); Logger::log("Done deleting ".$count." orphaned data from thread table. Last ID: ".$last_id);
Config::set('system', 'dbclean-last-id-3', $last_id); DI::config()->set('system', 'dbclean-last-id-3', $last_id);
if ($count < $limit) { if ($count < $limit) {
Config::set('system', 'finished-dbclean-3', true); DI::config()->set('system', 'finished-dbclean-3', true);
} }
} elseif ($stage == 4) { } elseif ($stage == 4) {
$last_id = DI::config()->get('system', 'dbclean-last-id-4', 0); $last_id = DI::config()->get('system', 'dbclean-last-id-4', 0);
@ -172,10 +172,10 @@ class DBClean {
DBA::close($r); DBA::close($r);
Logger::log("Done deleting ".$count." orphaned data from notify table. Last ID: ".$last_id); Logger::log("Done deleting ".$count." orphaned data from notify table. Last ID: ".$last_id);
Config::set('system', 'dbclean-last-id-4', $last_id); DI::config()->set('system', 'dbclean-last-id-4', $last_id);
if ($count < $limit) { if ($count < $limit) {
Config::set('system', 'finished-dbclean-4', true); DI::config()->set('system', 'finished-dbclean-4', true);
} }
} elseif ($stage == 5) { } elseif ($stage == 5) {
$last_id = DI::config()->get('system', 'dbclean-last-id-5', 0); $last_id = DI::config()->get('system', 'dbclean-last-id-5', 0);
@ -198,10 +198,10 @@ class DBClean {
DBA::close($r); DBA::close($r);
Logger::log("Done deleting ".$count." orphaned data from notify-threads table. Last ID: ".$last_id); Logger::log("Done deleting ".$count." orphaned data from notify-threads table. Last ID: ".$last_id);
Config::set('system', 'dbclean-last-id-5', $last_id); DI::config()->set('system', 'dbclean-last-id-5', $last_id);
if ($count < $limit) { if ($count < $limit) {
Config::set('system', 'finished-dbclean-5', true); DI::config()->set('system', 'finished-dbclean-5', true);
} }
} elseif ($stage == 6) { } elseif ($stage == 6) {
$last_id = DI::config()->get('system', 'dbclean-last-id-6', 0); $last_id = DI::config()->get('system', 'dbclean-last-id-6', 0);
@ -224,10 +224,10 @@ class DBClean {
DBA::close($r); DBA::close($r);
Logger::log("Done deleting ".$count." orphaned data from sign table. Last ID: ".$last_id); Logger::log("Done deleting ".$count." orphaned data from sign table. Last ID: ".$last_id);
Config::set('system', 'dbclean-last-id-6', $last_id); DI::config()->set('system', 'dbclean-last-id-6', $last_id);
if ($count < $limit) { if ($count < $limit) {
Config::set('system', 'finished-dbclean-6', true); DI::config()->set('system', 'finished-dbclean-6', true);
} }
} elseif ($stage == 7) { } elseif ($stage == 7) {
$last_id = DI::config()->get('system', 'dbclean-last-id-7', 0); $last_id = DI::config()->get('system', 'dbclean-last-id-7', 0);
@ -250,10 +250,10 @@ class DBClean {
DBA::close($r); DBA::close($r);
Logger::log("Done deleting ".$count." orphaned data from term table. Last ID: ".$last_id); Logger::log("Done deleting ".$count." orphaned data from term table. Last ID: ".$last_id);
Config::set('system', 'dbclean-last-id-7', $last_id); DI::config()->set('system', 'dbclean-last-id-7', $last_id);
if ($count < $limit) { if ($count < $limit) {
Config::set('system', 'finished-dbclean-7', true); DI::config()->set('system', 'finished-dbclean-7', true);
} }
} elseif ($stage == 8) { } elseif ($stage == 8) {
if ($days <= 0) { if ($days <= 0) {
@ -289,7 +289,7 @@ class DBClean {
DBA::close($r); DBA::close($r);
Logger::log("Done deleting ".$count." expired threads. Last ID: ".$last_id); Logger::log("Done deleting ".$count." expired threads. Last ID: ".$last_id);
Config::set('system', 'dbclean-last-id-8', $last_id); DI::config()->set('system', 'dbclean-last-id-8', $last_id);
} elseif ($stage == 9) { } elseif ($stage == 9) {
if ($days <= 0) { if ($days <= 0) {
return; return;
@ -317,7 +317,7 @@ class DBClean {
DBA::close($r); DBA::close($r);
Logger::log("Done deleting ".$count." old global item entries from expired threads. Last ID: ".$last_id); Logger::log("Done deleting ".$count." old global item entries from expired threads. Last ID: ".$last_id);
Config::set('system', 'dbclean-last-id-9', $last_id); DI::config()->set('system', 'dbclean-last-id-9', $last_id);
} elseif ($stage == 10) { } elseif ($stage == 10) {
$last_id = DI::config()->get('system', 'dbclean-last-id-10', 0); $last_id = DI::config()->get('system', 'dbclean-last-id-10', 0);
$days = intval(DI::config()->get('system', 'dbclean_expire_conversation', 90)); $days = intval(DI::config()->get('system', 'dbclean_expire_conversation', 90));
@ -340,7 +340,7 @@ class DBClean {
DBA::close($r); DBA::close($r);
Logger::log("Done deleting ".$count." conversations. Last created: ".$last_id); Logger::log("Done deleting ".$count." conversations. Last created: ".$last_id);
Config::set('system', 'dbclean-last-id-10', $last_id); DI::config()->set('system', 'dbclean-last-id-10', $last_id);
} }
} }
} }

View file

@ -21,11 +21,11 @@ class DBATest extends DatabaseTest
DI::init($dice); DI::init($dice);
// Default config // Default config
Config::set('config', 'hostname', 'localhost'); DI::config()->set('config', 'hostname', 'localhost');
Config::set('system', 'throttle_limit_day', 100); DI::config()->set('system', 'throttle_limit_day', 100);
Config::set('system', 'throttle_limit_week', 100); DI::config()->set('system', 'throttle_limit_week', 100);
Config::set('system', 'throttle_limit_month', 100); DI::config()->set('system', 'throttle_limit_month', 100);
Config::set('system', 'theme', 'system_theme'); DI::config()->set('system', 'theme', 'system_theme');
} }
/** /**

View file

@ -65,7 +65,7 @@ function update_1178()
function update_1179() function update_1179()
{ {
if (DI::config()->get('system', 'no_community_page')) { if (DI::config()->get('system', 'no_community_page')) {
Config::set('system', 'community_page_style', CP_NO_COMMUNITY_PAGE); DI::config()->set('system', 'community_page_style', CP_NO_COMMUNITY_PAGE);
} }
// Update the central item storage with uid=0 // Update the central item storage with uid=0
@ -88,7 +88,7 @@ function update_1189()
if (strlen(DI::config()->get('system', 'directory_submit_url')) && if (strlen(DI::config()->get('system', 'directory_submit_url')) &&
!strlen(DI::config()->get('system', 'directory'))) { !strlen(DI::config()->get('system', 'directory'))) {
Config::set('system', 'directory', dirname(DI::config()->get('system', 'directory_submit_url'))); DI::config()->set('system', 'directory', dirname(DI::config()->get('system', 'directory_submit_url')));
Config::delete('system', 'directory_submit_url'); Config::delete('system', 'directory_submit_url');
} }
@ -97,7 +97,7 @@ function update_1189()
function update_1191() function update_1191()
{ {
Config::set('system', 'maintenance', 1); DI::config()->set('system', 'maintenance', 1);
if (Addon::isEnabled('forumlist')) { if (Addon::isEnabled('forumlist')) {
$addon = 'forumlist'; $addon = 'forumlist';
@ -114,7 +114,7 @@ function update_1191()
// since Addon::uninstall() don't work here // since Addon::uninstall() don't work here
q("DELETE FROM `addon` WHERE `name` = 'forumlist' "); q("DELETE FROM `addon` WHERE `name` = 'forumlist' ");
q("DELETE FROM `hook` WHERE `file` = 'addon/forumlist/forumlist.php' "); q("DELETE FROM `hook` WHERE `file` = 'addon/forumlist/forumlist.php' ");
Config::set('system', 'addon', implode(", ", $addons_arr)); DI::config()->set('system', 'addon', implode(", ", $addons_arr));
} }
} }
} }
@ -154,7 +154,7 @@ function update_1191()
} }
} }
Config::set('system', 'maintenance', 0); DI::config()->set('system', 'maintenance', 0);
return Update::SUCCESS; return Update::SUCCESS;
} }
@ -193,7 +193,7 @@ function update_1245()
return Update::SUCCESS; return Update::SUCCESS;
} }
Config::set('system', 'rino_encrypt', 1); DI::config()->set('system', 'rino_encrypt', 1);
return Update::SUCCESS; return Update::SUCCESS;
} }
@ -210,8 +210,8 @@ WHERE `hook` LIKE 'plugin_%'");
function update_1260() function update_1260()
{ {
Config::set('system', 'maintenance', 1); DI::config()->set('system', 'maintenance', 1);
Config::set( DI::config()->set(
'system', 'system',
'maintenance_reason', 'maintenance_reason',
DI::l10n()->t( DI::l10n()->t(
@ -252,7 +252,7 @@ function update_1260()
DBA::e("UPDATE `thread` INNER JOIN `item` ON `thread`.`iid` = `item`.`id` DBA::e("UPDATE `thread` INNER JOIN `item` ON `thread`.`iid` = `item`.`id`
SET `thread`.`author-id` = `item`.`author-id` WHERE `thread`.`author-id` = 0"); SET `thread`.`author-id` = `item`.`author-id` WHERE `thread`.`author-id` = 0");
Config::set('system', 'maintenance', 0); DI::config()->set('system', 'maintenance', 0);
return Update::SUCCESS; return Update::SUCCESS;
} }
@ -265,8 +265,8 @@ function update_1261()
function update_1278() function update_1278()
{ {
Config::set('system', 'maintenance', 1); DI::config()->set('system', 'maintenance', 1);
Config::set( DI::config()->set(
'system', 'system',
'maintenance_reason', 'maintenance_reason',
DI::l10n()->t( DI::l10n()->t(
@ -278,7 +278,7 @@ function update_1278()
Item::update(['post-type' => Item::PT_PAGE], ['bookmark' => true]); Item::update(['post-type' => Item::PT_PAGE], ['bookmark' => true]);
Item::update(['post-type' => Item::PT_PERSONAL_NOTE], ['type' => 'note']); Item::update(['post-type' => Item::PT_PERSONAL_NOTE], ['type' => 'note']);
Config::set('system', 'maintenance', 0); DI::config()->set('system', 'maintenance', 0);
return Update::SUCCESS; return Update::SUCCESS;
} }
@ -415,7 +415,7 @@ function update_1330()
// set the name of the storage instead of the classpath as config // set the name of the storage instead of the classpath as config
if (!empty($currStorage)) { if (!empty($currStorage)) {
/** @var Storage\IStorage $currStorage */ /** @var Storage\IStorage $currStorage */
if (!Config::set('storage', 'name', $currStorage::getName())) { if (!DI::config()->set('storage', 'name', $currStorage::getName())) {
return Update::FAILED; return Update::FAILED;
} }

View file

@ -42,7 +42,7 @@ function theme_admin(App $a)
function theme_admin_post(App $a) function theme_admin_post(App $a)
{ {
if (isset($_POST['duepuntozero-settings-submit'])) { if (isset($_POST['duepuntozero-settings-submit'])) {
Config::set('duepuntozero', 'colorset', $_POST['duepuntozero_colorset']); DI::config()->set('duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
} }
} }

View file

@ -34,18 +34,18 @@ function theme_admin_post(App $a)
} }
if (isset($_POST['frio-settings-submit'])) { if (isset($_POST['frio-settings-submit'])) {
Config::set('frio', 'scheme', $_POST['frio_scheme'] ?? ''); DI::config()->set('frio', 'scheme', $_POST['frio_scheme'] ?? '');
Config::set('frio', 'nav_bg', $_POST['frio_nav_bg'] ?? ''); DI::config()->set('frio', 'nav_bg', $_POST['frio_nav_bg'] ?? '');
Config::set('frio', 'nav_icon_color', $_POST['frio_nav_icon_color'] ?? ''); DI::config()->set('frio', 'nav_icon_color', $_POST['frio_nav_icon_color'] ?? '');
Config::set('frio', 'link_color', $_POST['frio_link_color'] ?? ''); DI::config()->set('frio', 'link_color', $_POST['frio_link_color'] ?? '');
Config::set('frio', 'background_color', $_POST['frio_background_color'] ?? ''); DI::config()->set('frio', 'background_color', $_POST['frio_background_color'] ?? '');
Config::set('frio', 'contentbg_transp', $_POST['frio_contentbg_transp'] ?? ''); DI::config()->set('frio', 'contentbg_transp', $_POST['frio_contentbg_transp'] ?? '');
Config::set('frio', 'background_image', $_POST['frio_background_image'] ?? ''); DI::config()->set('frio', 'background_image', $_POST['frio_background_image'] ?? '');
Config::set('frio', 'bg_image_option', $_POST['frio_bg_image_option'] ?? ''); DI::config()->set('frio', 'bg_image_option', $_POST['frio_bg_image_option'] ?? '');
Config::set('frio', 'login_bg_image', $_POST['frio_login_bg_image'] ?? ''); DI::config()->set('frio', 'login_bg_image', $_POST['frio_login_bg_image'] ?? '');
Config::set('frio', 'login_bg_color', $_POST['frio_login_bg_color'] ?? ''); DI::config()->set('frio', 'login_bg_color', $_POST['frio_login_bg_color'] ?? '');
Config::set('frio', 'css_modified', time()); DI::config()->set('frio', 'css_modified', time());
Config::set('frio', 'enable_compose', $_POST['frio_enable_compose'] ?? 0); DI::config()->set('frio', 'enable_compose', $_POST['frio_enable_compose'] ?? 0);
} }
} }

View file

@ -45,10 +45,10 @@ function theme_admin(App $a) {
function theme_admin_post(App $a) { function theme_admin_post(App $a) {
if (isset($_POST['quattro-settings-submit'])){ if (isset($_POST['quattro-settings-submit'])){
Config::set('quattro', 'align', $_POST['quattro_align']); DI::config()->set('quattro', 'align', $_POST['quattro_align']);
Config::set('quattro', 'color', $_POST['quattro_color']); DI::config()->set('quattro', 'color', $_POST['quattro_color']);
Config::set('quattro', 'tfs', $_POST['quattro_tfs']); DI::config()->set('quattro', 'tfs', $_POST['quattro_tfs']);
Config::set('quattro', 'pfs', $_POST['quattro_pfs']); DI::config()->set('quattro', 'pfs', $_POST['quattro_pfs']);
} }
} }

View file

@ -90,14 +90,14 @@ function theme_admin(App $a) {
function theme_admin_post(App $a) { function theme_admin_post(App $a) {
if (isset($_POST['vier-settings-submit'])){ if (isset($_POST['vier-settings-submit'])){
Config::set('vier', 'style', $_POST['vier_style']); DI::config()->set('vier', 'style', $_POST['vier_style']);
Config::set('vier', 'show_pages', $_POST['vier_show_pages']); DI::config()->set('vier', 'show_pages', $_POST['vier_show_pages']);
Config::set('vier', 'show_profiles', $_POST['vier_show_profiles']); DI::config()->set('vier', 'show_profiles', $_POST['vier_show_profiles']);
Config::set('vier', 'show_helpers', $_POST['vier_show_helpers']); DI::config()->set('vier', 'show_helpers', $_POST['vier_show_helpers']);
Config::set('vier', 'show_services', $_POST['vier_show_services']); DI::config()->set('vier', 'show_services', $_POST['vier_show_services']);
Config::set('vier', 'show_friends', $_POST['vier_show_friends']); DI::config()->set('vier', 'show_friends', $_POST['vier_show_friends']);
Config::set('vier', 'show_lastusers', $_POST['vier_show_lastusers']); DI::config()->set('vier', 'show_lastusers', $_POST['vier_show_lastusers']);
Config::set('vier', 'helperlist', $_POST['vier_helperlist']); DI::config()->set('vier', 'helperlist', $_POST['vier_helperlist']);
} }
} }