}
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");
}
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");
}
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");
}
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
set_time_limit(0);
if (System::isDirectoryUsable($new_temppath)) {
// The new path is usable, we are happy
- Config::set("system", "temppath", $new_temppath);
+ DI::config()->set("system", "temppath", $new_temppath);
return $new_temppath;
} else {
// We can't create a subdirectory, strange.
}
if (System::isDirectoryUsable($itemcache)) {
- Config::set("system", "itemcache", $itemcache);
+ DI::config()->set("system", "itemcache", $itemcache);
return $itemcache;
}
}
if (System::isDirectoryUsable($spoolpath)) {
// The new path is usable, we are happy
- Config::set("system", "spoolpath", $spoolpath);
+ DI::config()->set("system", "spoolpath", $spoolpath);
return $spoolpath;
} else {
// We can't create a subdirectory, strange.
$consumer = new OAuthConsumer($app['client_id'], $app['pw'], $app['redirect_uri']);
$verifier = md5($app['secret'] . local_user());
- Config::set("oauth", $verifier, local_user());
+ DI::config()->set("oauth", $verifier, local_user());
if ($consumer->callback_url != null) {
$params = $request->get_parameters();
*/
public static function saveEnabledList()
{
- return Config::set('system', 'addon', implode(',', self::$addons));
+ return DI::config()->set('system', 'addon', implode(',', self::$addons));
}
/**
*/
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.
*
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)));
}
/**
$build = DI::config()->get('system', '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;
}
if (empty($build) || ($build > DB_UPDATE_VERSION)) {
$build = DB_UPDATE_VERSION - 1;
- Config::set('system', 'build', $build);
+ DI::config()->set('system', 'build', $build);
}
if ($build != DB_UPDATE_VERSION || $force) {
for ($x = $stored + 1; $x <= $current; $x++) {
$r = self::runUpdateFunction($x, 'pre_update');
if (!$r) {
- Config::set('system', 'update', Update::FAILED);
+ DI::config()->set('system', 'update', Update::FAILED);
DI::lock()->release('dbupdate');
return $r;
}
);
}
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');
return $retval;
} else {
- Config::set('database', 'last_successful_update', $current);
- Config::set('database', 'last_successful_update_time', time());
+ DI::config()->set('database', 'last_successful_update', $current);
+ DI::config()->set('database', 'last_successful_update_time', time());
Logger::info('Update finished.', ['from' => $stored, 'to' => $current]);
}
for ($x = $stored + 1; $x <= $current; $x++) {
$r = self::runUpdateFunction($x, 'update');
if (!$r) {
- Config::set('system', 'update', Update::FAILED);
+ DI::config()->set('system', 'update', Update::FAILED);
DI::lock()->release('dbupdate');
return $r;
}
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_function');
return false;
} else {
- 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', $funcname);
+ DI::config()->set('database', 'last_successful_update_function_time', time());
if ($prefix == 'update') {
- Config::set('system', 'build', $x);
+ DI::config()->set('system', 'build', $x);
}
DI::lock()->release('dbupdate_function');
} else {
Logger::info('Update function skipped.', ['function' => $funcname]);
- 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', $funcname);
+ DI::config()->set('database', 'last_successful_update_function_time', time());
if ($prefix == 'update') {
- Config::set('system', 'build', $x);
+ DI::config()->set('system', 'build', $x);
}
return true;
// Kill stale processes every 5 minutes
$last_cleanup = DI::config()->get('system', 'worker_last_cleaned', 0);
if (time() > ($last_cleanup + 300)) {
- Config::set('system', 'worker_last_cleaned', time());
+ DI::config()->set('system', 'worker_last_cleaned', time());
self::killStaleWorkers();
}
$stamp = (float)microtime(true);
$condition = ["`id` = ? AND `next_try` < ?", $queue['id'], DateTimeFormat::utcNow()];
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_write += (microtime(true) - $stamp);
$stamp = (float)microtime(true);
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_write += (microtime(true) - $stamp);
return;
}
- Config::set("system", "worker_started", time());
+ DI::config()->set("system", "worker_started", time());
// Do we have enough running workers? Then we quit here.
if (self::tooMuchWorkers()) {
public static function update($basePath, $verbose, $action, $install = false, array $tables = null, array $definition = null)
{
if ($action && !$install) {
- 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', 1);
+ DI::config()->set('system', 'maintenance_reason', DI::l10n()->t('%s: Database update', DateTimeFormat::utcNow() . ' ' . date('e')));
}
$errors = '';
if ($action) {
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
}
if ($action && !$install) {
- Config::set('system', 'maintenance', 0);
- Config::set('system', 'maintenance_reason', '');
+ DI::config()->set('system', 'maintenance', 0);
+ DI::config()->set('system', 'maintenance_reason', '');
if ($errors) {
- Config::set('system', 'dbupdate', self::UPDATE_FAILED);
+ DI::config()->set('system', 'dbupdate', self::UPDATE_FAILED);
} else {
- Config::set('system', 'dbupdate', self::UPDATE_SUCCESSFUL);
+ DI::config()->set('system', 'dbupdate', self::UPDATE_SUCCESSFUL);
}
}
if (!$end_id) {
$r = q("SELECT `id` FROM `item` WHERE `uid` != 0 ORDER BY `id` DESC LIMIT 1");
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");
}
}
intval($start_id), intval($end_id),
DBA::escape(Protocol::DFRN), DBA::escape(Protocol::DIASPORA), DBA::escape(Protocol::OSTATUS));
if (!$r) {
- Config::set("system", "post_update_version", 1194);
+ DI::config()->set("system", "post_update_version", 1194);
Logger::log("Update is done", Logger::DEBUG);
return true;
} 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");
}
}
}
- Config::set("system", "post_update_version", 1206);
+ DI::config()->set("system", "post_update_version", 1206);
Logger::log("Done", Logger::DEBUG);
return true;
}
}
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);
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);
return true;
}
}
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("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");
- Config::set("system", "post_update_version", 1281);
+ DI::config()->set("system", "post_update_version", 1281);
Logger::log("Done", Logger::DEBUG);
return true;
}
Logger::info('Processed rows: ' . DBA::affectedRows());
- Config::set('system', 'post_update_version', 1297);
+ DI::config()->set('system', 'post_update_version', 1297);
Logger::info('Done');
}
DBA::close($contact);
- Config::set('system', 'post_update_version', 1322);
+ DI::config()->set('system', 'post_update_version', 1322);
Logger::info('Done');
}
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]);
if ($start_id == $id) {
- Config::set('system', 'post_update_version', 1329);
+ DI::config()->set('system', 'post_update_version', 1329);
Logger::info('Done');
return true;
}
}
}
- Config::set('poco', 'last_federation_discovery', time());
+ DI::config()->set('poco', 'last_federation_discovery', time());
}
}
'domain' => Strings::escapeTags(trim($_POST['newentry_domain'])),
'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);
} else {
// Edit the entries from blocklist
];
}
}
- Config::set('system', 'blocklist', $blocklist);
+ DI::config()->set('system', 'blocklist', $blocklist);
info(DI::l10n()->t('Site blocklist updated.') . EOL);
}
// @TODO: Replace with parameter from router
$update = intval($a->argv[3]);
if ($update) {
- Config::set('database', 'update_' . $update, 'success');
+ DI::config()->set('database', 'update_' . $update, 'success');
$curr = DI::config()->get('system', 'build');
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);
}
$retval = DBStructure::update($a->getBasePath(), false, true);
if ($retval === '') {
$o .= DI::l10n()->t("Database structure update %s was successfully applied.", DB_UPDATE_VERSION) . "<br />";
- Config::set('database', 'last_successful_update', DB_UPDATE_VERSION);
- Config::set('database', 'last_successful_update_time', time());
+ DI::config()->set('database', 'last_successful_update', DB_UPDATE_VERSION);
+ DI::config()->set('database', 'last_successful_update_time', time());
} 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 %s failed with error: %s", $func, $retval);
} elseif ($retval === Update::SUCCESS) {
$o .= DI::l10n()->t('Update %s was successfully applied.', $func);
- Config::set('database', $func, 'success');
+ DI::config()->set('database', $func, 'success');
} else {
$o .= DI::l10n()->t('Update %s did not return a status. Unknown if it succeeded.', $func);
}
} else {
$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;
} else {
$val = 0;
}
- Config::set('feature', $feature, $val);
+ DI::config()->set('feature', $feature, $val);
if (!empty($_POST[$featurelock])) {
- Config::set('feature_lock', $feature, $val);
+ DI::config()->set('feature_lock', $feature, $val);
} else {
Config::delete('feature_lock', $feature);
}
return;
}
- Config::set('system', 'logfile', $logfile);
- Config::set('system', 'debugging', $debugging);
- Config::set('system', 'loglevel', $loglevel);
+ DI::config()->set('system', 'logfile', $logfile);
+ DI::config()->set('system', 'debugging', $debugging);
+ DI::config()->set('system', 'loglevel', $loglevel);
}
info(DI::l10n()->t("Log settings updated."));
update_table($a, "gcontact", ['connect', 'addr'], $old_host, $new_host);
// update config
- Config::set('system', 'url', $new_url);
+ DI::config()->set('system', 'url', $new_url);
DI::baseUrl()->saveByURL($new_url);
// send relocate
// Has the directory url changed? If yes, then resubmit the existing profiles there
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');
}
);
}
}
- Config::set('system', 'ssl_policy' , $ssl_policy);
- Config::set('system', 'maxloadavg' , $maxloadavg);
- Config::set('system', 'maxloadavg_frontend' , $maxloadavg_frontend);
- Config::set('system', 'min_memory' , $min_memory);
- Config::set('system', 'optimize_max_tablesize', $optimize_max_tablesize);
- Config::set('system', 'optimize_fragmentation', $optimize_fragmentation);
- Config::set('system', 'poco_completion' , $poco_completion);
- Config::set('system', 'poco_requery_days' , $poco_requery_days);
- Config::set('system', 'poco_discovery' , $poco_discovery);
- Config::set('system', 'poco_discovery_since' , $poco_discovery_since);
- Config::set('system', 'poco_local_search' , $poco_local_search);
- Config::set('system', 'nodeinfo' , $nodeinfo);
- Config::set('config', 'sitename' , $sitename);
- Config::set('config', 'sender_email' , $sender_email);
- Config::set('system', 'suppress_tags' , $suppress_tags);
- Config::set('system', 'shortcut_icon' , $shortcut_icon);
- Config::set('system', 'touch_icon' , $touch_icon);
+ DI::config()->set('system', 'ssl_policy' , $ssl_policy);
+ DI::config()->set('system', 'maxloadavg' , $maxloadavg);
+ DI::config()->set('system', 'maxloadavg_frontend' , $maxloadavg_frontend);
+ DI::config()->set('system', 'min_memory' , $min_memory);
+ DI::config()->set('system', 'optimize_max_tablesize', $optimize_max_tablesize);
+ DI::config()->set('system', 'optimize_fragmentation', $optimize_fragmentation);
+ DI::config()->set('system', 'poco_completion' , $poco_completion);
+ DI::config()->set('system', 'poco_requery_days' , $poco_requery_days);
+ DI::config()->set('system', 'poco_discovery' , $poco_discovery);
+ DI::config()->set('system', 'poco_discovery_since' , $poco_discovery_since);
+ DI::config()->set('system', 'poco_local_search' , $poco_local_search);
+ DI::config()->set('system', 'nodeinfo' , $nodeinfo);
+ DI::config()->set('config', 'sitename' , $sitename);
+ DI::config()->set('config', 'sender_email' , $sender_email);
+ DI::config()->set('system', 'suppress_tags' , $suppress_tags);
+ DI::config()->set('system', 'shortcut_icon' , $shortcut_icon);
+ DI::config()->set('system', 'touch_icon' , $touch_icon);
if ($banner == "") {
Config::delete('system', 'banner');
} else {
- Config::set('system', 'banner', $banner);
+ DI::config()->set('system', 'banner', $banner);
}
if (empty($additional_info)) {
Config::delete('config', 'info');
} else {
- Config::set('config', 'info', $additional_info);
+ DI::config()->set('config', 'info', $additional_info);
}
- Config::set('system', 'language', $language);
- Config::set('system', 'theme', $theme);
+ DI::config()->set('system', 'language', $language);
+ DI::config()->set('system', 'theme', $theme);
Theme::install($theme);
if ($theme_mobile == '---') {
Config::delete('system', 'mobile-theme');
} else {
- Config::set('system', 'mobile-theme', $theme_mobile);
+ DI::config()->set('system', 'mobile-theme', $theme_mobile);
}
if ($singleuser == '---') {
Config::delete('system', 'singleuser');
} else {
- Config::set('system', 'singleuser', $singleuser);
+ DI::config()->set('system', 'singleuser', $singleuser);
}
- Config::set('system', 'maximagesize' , $maximagesize);
- Config::set('system', 'max_image_length' , $maximagelength);
- Config::set('system', 'jpeg_quality' , $jpegimagequality);
-
- Config::set('config', 'register_policy' , $register_policy);
- Config::set('system', 'max_daily_registrations', $daily_registrations);
- Config::set('system', 'account_abandon_days' , $abandon_days);
- Config::set('config', 'register_text' , $register_text);
- Config::set('system', 'allowed_sites' , $allowed_sites);
- Config::set('system', 'allowed_email' , $allowed_email);
- Config::set('system', 'forbidden_nicknames' , $forbidden_nicknames);
- Config::set('system', 'no_oembed_rich_content' , $no_oembed_rich_content);
- Config::set('system', 'allowed_oembed' , $allowed_oembed);
- Config::set('system', 'block_public' , $block_public);
- Config::set('system', 'publish_all' , $force_publish);
- Config::set('system', 'newuser_private' , $newuser_private);
- Config::set('system', 'enotify_no_content' , $enotify_no_content);
- Config::set('system', 'disable_embedded' , $disable_embedded);
- Config::set('system', 'allow_users_remote_self', $allow_users_remote_self);
- Config::set('system', 'explicit_content' , $explicit_content);
- Config::set('system', 'check_new_version_url' , $check_new_version_url);
-
- Config::set('system', 'block_extended_register', $no_multi_reg);
- Config::set('system', 'no_openid' , $no_openid);
- Config::set('system', 'no_regfullname' , $no_regfullname);
- Config::set('system', 'community_page_style' , $community_page_style);
- Config::set('system', 'max_author_posts_community_page', $max_author_posts_community_page);
- Config::set('system', 'verifyssl' , $verifyssl);
- Config::set('system', 'proxyuser' , $proxyuser);
- Config::set('system', 'proxy' , $proxy);
- Config::set('system', 'curl_timeout' , $timeout);
- Config::set('system', 'dfrn_only' , $dfrn_only);
- Config::set('system', 'ostatus_disabled' , $ostatus_disabled);
- Config::set('system', 'diaspora_enabled' , $diaspora_enabled);
-
- Config::set('config', 'private_addons' , $private_addons);
-
- Config::set('system', 'force_ssl' , $force_ssl);
- Config::set('system', 'hide_help' , $hide_help);
-
- Config::set('system', 'dbclean' , $dbclean);
- Config::set('system', 'dbclean-expire-days' , $dbclean_expire_days);
- Config::set('system', 'dbclean_expire_conversation', $dbclean_expire_conv);
+ DI::config()->set('system', 'maximagesize' , $maximagesize);
+ DI::config()->set('system', 'max_image_length' , $maximagelength);
+ DI::config()->set('system', 'jpeg_quality' , $jpegimagequality);
+
+ DI::config()->set('config', 'register_policy' , $register_policy);
+ DI::config()->set('system', 'max_daily_registrations', $daily_registrations);
+ DI::config()->set('system', 'account_abandon_days' , $abandon_days);
+ DI::config()->set('config', 'register_text' , $register_text);
+ DI::config()->set('system', 'allowed_sites' , $allowed_sites);
+ DI::config()->set('system', 'allowed_email' , $allowed_email);
+ DI::config()->set('system', 'forbidden_nicknames' , $forbidden_nicknames);
+ DI::config()->set('system', 'no_oembed_rich_content' , $no_oembed_rich_content);
+ DI::config()->set('system', 'allowed_oembed' , $allowed_oembed);
+ DI::config()->set('system', 'block_public' , $block_public);
+ DI::config()->set('system', 'publish_all' , $force_publish);
+ DI::config()->set('system', 'newuser_private' , $newuser_private);
+ DI::config()->set('system', 'enotify_no_content' , $enotify_no_content);
+ DI::config()->set('system', 'disable_embedded' , $disable_embedded);
+ DI::config()->set('system', 'allow_users_remote_self', $allow_users_remote_self);
+ DI::config()->set('system', 'explicit_content' , $explicit_content);
+ DI::config()->set('system', 'check_new_version_url' , $check_new_version_url);
+
+ DI::config()->set('system', 'block_extended_register', $no_multi_reg);
+ DI::config()->set('system', 'no_openid' , $no_openid);
+ DI::config()->set('system', 'no_regfullname' , $no_regfullname);
+ DI::config()->set('system', 'community_page_style' , $community_page_style);
+ DI::config()->set('system', 'max_author_posts_community_page', $max_author_posts_community_page);
+ DI::config()->set('system', 'verifyssl' , $verifyssl);
+ DI::config()->set('system', 'proxyuser' , $proxyuser);
+ DI::config()->set('system', 'proxy' , $proxy);
+ DI::config()->set('system', 'curl_timeout' , $timeout);
+ DI::config()->set('system', 'dfrn_only' , $dfrn_only);
+ DI::config()->set('system', 'ostatus_disabled' , $ostatus_disabled);
+ DI::config()->set('system', 'diaspora_enabled' , $diaspora_enabled);
+
+ DI::config()->set('config', 'private_addons' , $private_addons);
+
+ DI::config()->set('system', 'force_ssl' , $force_ssl);
+ DI::config()->set('system', 'hide_help' , $hide_help);
+
+ DI::config()->set('system', 'dbclean' , $dbclean);
+ DI::config()->set('system', 'dbclean-expire-days' , $dbclean_expire_days);
+ DI::config()->set('system', 'dbclean_expire_conversation', $dbclean_expire_conv);
if ($dbclean_unclaimed == 0) {
$dbclean_unclaimed = $dbclean_expire_days;
}
- Config::set('system', 'dbclean-expire-unclaimed', $dbclean_unclaimed);
+ DI::config()->set('system', 'dbclean-expire-unclaimed', $dbclean_unclaimed);
if ($itemcache != '') {
$itemcache = BasePath::getRealPath($itemcache);
}
- Config::set('system', 'itemcache', $itemcache);
- Config::set('system', 'itemcache_duration', $itemcache_duration);
- Config::set('system', 'max_comments', $max_comments);
+ DI::config()->set('system', 'itemcache', $itemcache);
+ DI::config()->set('system', 'itemcache_duration', $itemcache_duration);
+ DI::config()->set('system', 'max_comments', $max_comments);
if ($temppath != '') {
$temppath = BasePath::getRealPath($temppath);
}
- Config::set('system', 'temppath', $temppath);
+ DI::config()->set('system', 'temppath', $temppath);
- Config::set('system', 'proxy_disabled' , $proxy_disabled);
- Config::set('system', 'only_tag_search' , $only_tag_search);
+ DI::config()->set('system', 'proxy_disabled' , $proxy_disabled);
+ DI::config()->set('system', 'only_tag_search' , $only_tag_search);
- Config::set('system', 'worker_queues' , $worker_queues);
- Config::set('system', 'worker_dont_fork' , $worker_dont_fork);
- Config::set('system', 'worker_fastlane' , $worker_fastlane);
- Config::set('system', 'frontend_worker' , $worker_frontend);
+ DI::config()->set('system', 'worker_queues' , $worker_queues);
+ DI::config()->set('system', 'worker_dont_fork' , $worker_dont_fork);
+ DI::config()->set('system', 'worker_fastlane' , $worker_fastlane);
+ DI::config()->set('system', 'frontend_worker' , $worker_frontend);
- Config::set('system', 'relay_directly' , $relay_directly);
- Config::set('system', 'relay_server' , $relay_server);
- Config::set('system', 'relay_subscribe' , $relay_subscribe);
- Config::set('system', 'relay_scope' , $relay_scope);
- Config::set('system', 'relay_server_tags', $relay_server_tags);
- Config::set('system', 'relay_user_tags' , $relay_user_tags);
+ DI::config()->set('system', 'relay_directly' , $relay_directly);
+ DI::config()->set('system', 'relay_server' , $relay_server);
+ DI::config()->set('system', 'relay_subscribe' , $relay_subscribe);
+ DI::config()->set('system', 'relay_scope' , $relay_scope);
+ DI::config()->set('system', 'relay_server_tags', $relay_server_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);
if (strlen(DI::config()->get('system', 'directory_submit_url')) &&
!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');
}
$confBasepath = $configCache->get('system', 'basepath');
$currBasepath = DI::config()->get('system', 'basepath');
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.', [
'from' => $currBasepath,
'to' => $confBasepath,
$displayprivstatement = !empty($_POST['displayprivstatement']);
$tostext = (!empty($_POST['tostext']) ? strip_tags(trim($_POST['tostext'])) : '');
- Config::set('system', 'tosdisplay', $displaytos);
- Config::set('system', 'tosprivstatement', $displayprivstatement);
- Config::set('system', 'tostext', $tostext);
+ DI::config()->set('system', 'tosdisplay', $displaytos);
+ DI::config()->set('system', 'tosprivstatement', $displayprivstatement);
+ DI::config()->set('system', 'tostext', $tostext);
info(DI::l10n()->t('The Terms of Service settings have been updated.'));
$pubkey = DI::config()->get('system', 'site_pubkey');
if (! $pubkey) {
$res = Crypto::newKeypair(1024);
- Config::set('system', 'site_prvkey', $res['prvkey']);
- Config::set('system', 'site_pubkey', $res['pubkey']);
+ DI::config()->set('system', 'site_prvkey', $res['prvkey']);
+ DI::config()->set('system', 'site_pubkey', $res['pubkey']);
}
$rp = q(
$gitversion = DBA::escape(trim(Network::fetchUrl($checked_url)));
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');
self::checkdeletedContacts();
- Config::set('system', 'last_expire_day', $d2);
+ DI::config()->set('system', 'last_expire_day', $d2);
}
// Hourly cron calls
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.
Logger::log('cron: end');
- Config::set('system', 'last_cron', time());
+ DI::config()->set('system', 'last_cron', time());
return;
}
}
}
- Config::set('system', 'cache_last_cleared', time());
+ DI::config()->set('system', 'cache_last_cleared', time());
}
/**
DBA::close($r);
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) {
$last_id = DI::config()->get('system', 'dbclean-last-id-2', 0);
DBA::close($r);
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) {
- Config::set('system', 'finished-dbclean-2', true);
+ DI::config()->set('system', 'finished-dbclean-2', true);
}
} elseif ($stage == 3) {
$last_id = DI::config()->get('system', 'dbclean-last-id-3', 0);
DBA::close($r);
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) {
- Config::set('system', 'finished-dbclean-3', true);
+ DI::config()->set('system', 'finished-dbclean-3', true);
}
} elseif ($stage == 4) {
$last_id = DI::config()->get('system', 'dbclean-last-id-4', 0);
DBA::close($r);
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) {
- Config::set('system', 'finished-dbclean-4', true);
+ DI::config()->set('system', 'finished-dbclean-4', true);
}
} elseif ($stage == 5) {
$last_id = DI::config()->get('system', 'dbclean-last-id-5', 0);
DBA::close($r);
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) {
- Config::set('system', 'finished-dbclean-5', true);
+ DI::config()->set('system', 'finished-dbclean-5', true);
}
} elseif ($stage == 6) {
$last_id = DI::config()->get('system', 'dbclean-last-id-6', 0);
DBA::close($r);
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) {
- Config::set('system', 'finished-dbclean-6', true);
+ DI::config()->set('system', 'finished-dbclean-6', true);
}
} elseif ($stage == 7) {
$last_id = DI::config()->get('system', 'dbclean-last-id-7', 0);
DBA::close($r);
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) {
- Config::set('system', 'finished-dbclean-7', true);
+ DI::config()->set('system', 'finished-dbclean-7', true);
}
} elseif ($stage == 8) {
if ($days <= 0) {
DBA::close($r);
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) {
if ($days <= 0) {
return;
DBA::close($r);
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) {
$last_id = DI::config()->get('system', 'dbclean-last-id-10', 0);
$days = intval(DI::config()->get('system', 'dbclean_expire_conversation', 90));
DBA::close($r);
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);
}
}
}
DI::init($dice);
// Default config
- Config::set('config', 'hostname', 'localhost');
- Config::set('system', 'throttle_limit_day', 100);
- Config::set('system', 'throttle_limit_week', 100);
- Config::set('system', 'throttle_limit_month', 100);
- Config::set('system', 'theme', 'system_theme');
+ DI::config()->set('config', 'hostname', 'localhost');
+ DI::config()->set('system', 'throttle_limit_day', 100);
+ DI::config()->set('system', 'throttle_limit_week', 100);
+ DI::config()->set('system', 'throttle_limit_month', 100);
+ DI::config()->set('system', 'theme', 'system_theme');
}
/**
function update_1179()
{
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
if (strlen(DI::config()->get('system', 'directory_submit_url')) &&
!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');
}
function update_1191()
{
- Config::set('system', 'maintenance', 1);
+ DI::config()->set('system', 'maintenance', 1);
if (Addon::isEnabled('forumlist')) {
$addon = 'forumlist';
// since Addon::uninstall() don't work here
q("DELETE FROM `addon` WHERE `name` = 'forumlist' ");
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));
}
}
}
}
}
- Config::set('system', 'maintenance', 0);
+ DI::config()->set('system', 'maintenance', 0);
return Update::SUCCESS;
}
return Update::SUCCESS;
}
- Config::set('system', 'rino_encrypt', 1);
+ DI::config()->set('system', 'rino_encrypt', 1);
return Update::SUCCESS;
}
function update_1260()
{
- Config::set('system', 'maintenance', 1);
- Config::set(
+ DI::config()->set('system', 'maintenance', 1);
+ DI::config()->set(
'system',
'maintenance_reason',
DI::l10n()->t(
DBA::e("UPDATE `thread` INNER JOIN `item` ON `thread`.`iid` = `item`.`id`
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;
}
function update_1278()
{
- Config::set('system', 'maintenance', 1);
- Config::set(
+ DI::config()->set('system', 'maintenance', 1);
+ DI::config()->set(
'system',
'maintenance_reason',
DI::l10n()->t(
Item::update(['post-type' => Item::PT_PAGE], ['bookmark' => true]);
Item::update(['post-type' => Item::PT_PERSONAL_NOTE], ['type' => 'note']);
- Config::set('system', 'maintenance', 0);
+ DI::config()->set('system', 'maintenance', 0);
return Update::SUCCESS;
}
// set the name of the storage instead of the classpath as config
if (!empty($currStorage)) {
/** @var Storage\IStorage $currStorage */
- if (!Config::set('storage', 'name', $currStorage::getName())) {
+ if (!DI::config()->set('storage', 'name', $currStorage::getName())) {
return Update::FAILED;
}
function theme_admin_post(App $a)
{
if (isset($_POST['duepuntozero-settings-submit'])) {
- Config::set('duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
+ DI::config()->set('duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
}
}
}
if (isset($_POST['frio-settings-submit'])) {
- Config::set('frio', 'scheme', $_POST['frio_scheme'] ?? '');
- Config::set('frio', 'nav_bg', $_POST['frio_nav_bg'] ?? '');
- Config::set('frio', 'nav_icon_color', $_POST['frio_nav_icon_color'] ?? '');
- Config::set('frio', 'link_color', $_POST['frio_link_color'] ?? '');
- Config::set('frio', 'background_color', $_POST['frio_background_color'] ?? '');
- Config::set('frio', 'contentbg_transp', $_POST['frio_contentbg_transp'] ?? '');
- Config::set('frio', 'background_image', $_POST['frio_background_image'] ?? '');
- Config::set('frio', 'bg_image_option', $_POST['frio_bg_image_option'] ?? '');
- Config::set('frio', 'login_bg_image', $_POST['frio_login_bg_image'] ?? '');
- Config::set('frio', 'login_bg_color', $_POST['frio_login_bg_color'] ?? '');
- Config::set('frio', 'css_modified', time());
- Config::set('frio', 'enable_compose', $_POST['frio_enable_compose'] ?? 0);
+ DI::config()->set('frio', 'scheme', $_POST['frio_scheme'] ?? '');
+ DI::config()->set('frio', 'nav_bg', $_POST['frio_nav_bg'] ?? '');
+ DI::config()->set('frio', 'nav_icon_color', $_POST['frio_nav_icon_color'] ?? '');
+ DI::config()->set('frio', 'link_color', $_POST['frio_link_color'] ?? '');
+ DI::config()->set('frio', 'background_color', $_POST['frio_background_color'] ?? '');
+ DI::config()->set('frio', 'contentbg_transp', $_POST['frio_contentbg_transp'] ?? '');
+ DI::config()->set('frio', 'background_image', $_POST['frio_background_image'] ?? '');
+ DI::config()->set('frio', 'bg_image_option', $_POST['frio_bg_image_option'] ?? '');
+ DI::config()->set('frio', 'login_bg_image', $_POST['frio_login_bg_image'] ?? '');
+ DI::config()->set('frio', 'login_bg_color', $_POST['frio_login_bg_color'] ?? '');
+ DI::config()->set('frio', 'css_modified', time());
+ DI::config()->set('frio', 'enable_compose', $_POST['frio_enable_compose'] ?? 0);
}
}
function theme_admin_post(App $a) {
if (isset($_POST['quattro-settings-submit'])){
- Config::set('quattro', 'align', $_POST['quattro_align']);
- Config::set('quattro', 'color', $_POST['quattro_color']);
- Config::set('quattro', 'tfs', $_POST['quattro_tfs']);
- Config::set('quattro', 'pfs', $_POST['quattro_pfs']);
+ DI::config()->set('quattro', 'align', $_POST['quattro_align']);
+ DI::config()->set('quattro', 'color', $_POST['quattro_color']);
+ DI::config()->set('quattro', 'tfs', $_POST['quattro_tfs']);
+ DI::config()->set('quattro', 'pfs', $_POST['quattro_pfs']);
}
}
function theme_admin_post(App $a) {
if (isset($_POST['vier-settings-submit'])){
- Config::set('vier', 'style', $_POST['vier_style']);
- Config::set('vier', 'show_pages', $_POST['vier_show_pages']);
- Config::set('vier', 'show_profiles', $_POST['vier_show_profiles']);
- Config::set('vier', 'show_helpers', $_POST['vier_show_helpers']);
- Config::set('vier', 'show_services', $_POST['vier_show_services']);
- Config::set('vier', 'show_friends', $_POST['vier_show_friends']);
- Config::set('vier', 'show_lastusers', $_POST['vier_show_lastusers']);
- Config::set('vier', 'helperlist', $_POST['vier_helperlist']);
+ DI::config()->set('vier', 'style', $_POST['vier_style']);
+ DI::config()->set('vier', 'show_pages', $_POST['vier_show_pages']);
+ DI::config()->set('vier', 'show_profiles', $_POST['vier_show_profiles']);
+ DI::config()->set('vier', 'show_helpers', $_POST['vier_show_helpers']);
+ DI::config()->set('vier', 'show_services', $_POST['vier_show_services']);
+ DI::config()->set('vier', 'show_friends', $_POST['vier_show_friends']);
+ DI::config()->set('vier', 'show_lastusers', $_POST['vier_show_lastusers']);
+ DI::config()->set('vier', 'helperlist', $_POST['vier_helperlist']);
}
}