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

This commit is contained in:
Philipp Holzer 2020-01-19 21:22:33 +01:00
parent 3411ced833
commit a6a2efa18a
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
5 changed files with 9 additions and 21 deletions

View file

@ -19,16 +19,4 @@ use Friendica\DI;
*/ */
class Config class Config
{ {
/**
* Deletes the given key from the system configuration.
*
* @param string $cat The category of the configuration value
* @param string $key The configuration key to delete
*
* @return bool
*/
public static function delete($cat, $key)
{
return DI::config()->delete($cat, $key);
}
} }

View file

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

View file

@ -297,13 +297,13 @@ class Site extends BaseAdminModule
DI::config()->set('system', 'touch_icon' , $touch_icon); DI::config()->set('system', 'touch_icon' , $touch_icon);
if ($banner == "") { if ($banner == "") {
Config::delete('system', 'banner'); DI::config()->delete('system', 'banner');
} else { } else {
DI::config()->set('system', 'banner', $banner); DI::config()->set('system', 'banner', $banner);
} }
if (empty($additional_info)) { if (empty($additional_info)) {
Config::delete('config', 'info'); DI::config()->delete('config', 'info');
} else { } else {
DI::config()->set('config', 'info', $additional_info); DI::config()->set('config', 'info', $additional_info);
} }
@ -312,12 +312,12 @@ class Site extends BaseAdminModule
Theme::install($theme); Theme::install($theme);
if ($theme_mobile == '---') { if ($theme_mobile == '---') {
Config::delete('system', 'mobile-theme'); DI::config()->delete('system', 'mobile-theme');
} else { } else {
DI::config()->set('system', 'mobile-theme', $theme_mobile); DI::config()->set('system', 'mobile-theme', $theme_mobile);
} }
if ($singleuser == '---') { if ($singleuser == '---') {
Config::delete('system', 'singleuser'); DI::config()->delete('system', 'singleuser');
} else { } else {
DI::config()->set('system', 'singleuser', $singleuser); DI::config()->set('system', 'singleuser', $singleuser);
} }
@ -417,7 +417,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'))) {
DI::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'); DI::config()->delete('system', 'directory_submit_url');
} }
/* Installed themes */ /* Installed themes */

View file

@ -177,7 +177,7 @@ class FKOAuthDataStore extends OAuthDataStore
DBA::delete('tokens', ['id' => $token->key]); DBA::delete('tokens', ['id' => $token->key]);
if (!is_null($ret) && !is_null($uverifier)) { if (!is_null($ret) && !is_null($uverifier)) {
Config::delete("oauth", $verifier); DI::config()->delete("oauth", $verifier);
} }
return $ret; return $ret;

View file

@ -89,7 +89,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'))) {
DI::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'); DI::config()->delete('system', 'directory_submit_url');
} }
return Update::SUCCESS; return Update::SUCCESS;
@ -420,7 +420,7 @@ function update_1330()
} }
// try to delete the class since it isn't needed. This won't work with config files // try to delete the class since it isn't needed. This won't work with config files
Config::delete('storage', 'class'); DI::config()->delete('storage', 'class');
} }
// Update attachments and photos // Update attachments and photos