plugins/libkolab

Aleksander Machniak machniak at kolabsys.com
Tue Aug 19 12:02:10 CEST 2014


 plugins/libkolab/lib/kolab_storage_config.php |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

New commits:
commit f9d152525ef93283fde9437113063b6e8af83502
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Mon Aug 18 12:09:47 2014 -0400

    Search all configuration folders not only subscribed (#3300)
    Create default configuration folder if it does not exist.

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;




More information about the commits mailing list