mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-20 14:36:52 +00:00
Merge pull request #654 from nextcloud/enh/621/timezone
allow to change the timezone
This commit is contained in:
commit
b4a8322a1a
10 changed files with 102 additions and 10 deletions
|
|
@ -483,4 +483,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