summaryrefslogtreecommitdiff
path: root/plugins/libkolab
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2014-08-18 16:09:47 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2014-08-18 16:09:47 (GMT)
commitf9d152525ef93283fde9437113063b6e8af83502 (patch)
tree8ae89895898215ec7d778bae6e8acbd7613fb8b7 /plugins/libkolab
parent06a910def335246f6cd5e00241ce0653d7467c97 (diff)
downloadroundcubemail-plugins-kolab-f9d152525ef93283fde9437113063b6e8af83502.tar.gz
Search all configuration folders not only subscribed (#3300)
Create default configuration folder if it does not exist.
Diffstat (limited to 'plugins/libkolab')
-rw-r--r--plugins/libkolab/lib/kolab_storage_config.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/plugins/libkolab/lib/kolab_storage_config.php b/plugins/libkolab/lib/kolab_storage_config.php
index 98a30ea..96c4460 100644
--- a/plugins/libkolab/lib/kolab_storage_config.php
+++ b/plugins/libkolab/lib/kolab_storage_config.php
@@ -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;