Search all configuration folders not only subscribed (#3300)
Create default configuration folder if it does not exist.
This commit is contained in:
parent
06a910def3
commit
f9d152525e
1 changed files with 13 additions and 2 deletions
|
@ -55,11 +55,12 @@ class kolab_storage_config
|
|||
}
|
||||
|
||||
/**
|
||||
* Private constructor
|
||||
* Private constructor (finds default configuration folder as a config source)
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
$this->folders = kolab_storage::get_folders(self::FOLDER_TYPE);
|
||||
// get all configuration folders
|
||||
$this->folders = kolab_storage::get_folders(self::FOLDER_TYPE, false);
|
||||
|
||||
foreach ($this->folders as $folder) {
|
||||
if ($folder->default) {
|
||||
|
@ -73,6 +74,16 @@ class kolab_storage_config
|
|||
$this->default = reset($this->folders);
|
||||
}
|
||||
|
||||
// attempt to create a default folder if it does not exist
|
||||
if (!$this->default) {
|
||||
$folder_name = 'Configuration';
|
||||
$folder_type = self::FOLDER_TYPE . '.default';
|
||||
|
||||
if (kolab_storage::folder_create($folder_name, $folder_type, true)) {
|
||||
$this->default = new kolab_storage_folder($folder_name, $folder_type);
|
||||
}
|
||||
}
|
||||
|
||||
// check if configuration folder exist
|
||||
if ($this->default && $this->default->name) {
|
||||
$this->enabled = true;
|
||||
|
|
Loading…
Add table
Reference in a new issue