adds directory scanning for apps as fallback
authorPhilipp Schüle <p.schuele@metaways.de>
Wed, 20 Jul 2016 08:10:32 +0000 (10:10 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 21 Jul 2016 14:32:20 +0000 (16:32 +0200)
... in searchServerPlugins

11976: prevent open_basedir error in searchServerPlugins

Change-Id: I1e4cb9050d225524b9fc3b7ec97aad4c73081b17
Reviewed-on: http://gerrit.tine20.com/customers/3373
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/Core.php

index 70a2001..daeaea5 100644 (file)
@@ -1622,8 +1622,6 @@ class Tinebase_Core
      * Search server plugins from applications configuration
      *
      * @return array
-     *
-     * TODO add feature switch for this
      */
     protected static function _searchServerPlugins()
     {
@@ -1636,12 +1634,24 @@ class Tinebase_Core
         }
 
         if (! Setup_Controller::getInstance()->isInstalled('Tinebase')) {
-            return array();
+            // get apps by scanning directory
+            $applications = array();
+            $d = dir(dirname(__DIR__));
+            while (false !== ($entry = $d->read())) {
+                if ($entry[0] == '.') {
+                    continue;
+                }
+
+                if (ctype_upper($entry[0]) && is_dir($d->path . DIRECTORY_SEPARATOR . $entry)) {
+                    $applications[] = $entry;
+                }
+            }
+            $d->close();
+        } else {
+            // get list of available applications
+            $applications = Tinebase_Application::getInstance()->getApplicationsByState(Tinebase_Application::ENABLED)->name;
         }
-        
-        // get list of available applications
-        $applications = Tinebase_Application::getInstance()->getApplicationsByState(Tinebase_Application::ENABLED)->name;
-        
+
         // get list of plugins
         $plugins = array();
         foreach ($applications as $application) {