mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-20 14:36:52 +00:00
allow to change the timezone
Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
parent
1cf5cf5509
commit
3e019d25f2
10 changed files with 102 additions and 10 deletions
|
|
@ -479,4 +479,33 @@ class ConfigurationManager
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function GetTimezone() : string {
|
||||
$config = $this->GetConfig();
|
||||
if(!isset($config['timezone'])) {
|
||||
$config['timezone'] = '';
|
||||
}
|
||||
|
||||
return $config['timezone'];
|
||||
}
|
||||
|
||||
public function SetTimezone(string $timezone) : void {
|
||||
if ($timezone === "") {
|
||||
throw new InvalidSettingConfigurationException("The timezone must not be empty!");
|
||||
}
|
||||
|
||||
if (!preg_match("#[a-zA-Z0-9_-/+]+$#", $timezone)) {
|
||||
throw new InvalidSettingConfigurationException("The entered timezone does not seem to be a valid timezone!");
|
||||
}
|
||||
|
||||
$config = $this->GetConfig();
|
||||
$config['timezone'] = $timezone;
|
||||
$this->WriteConfig($config);
|
||||
}
|
||||
|
||||
public function DeleteTimezone() : void {
|
||||
$config = $this->GetConfig();
|
||||
$config['timezone'] = '';
|
||||
$this->WriteConfig($config);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue