saves isFileSystemAvailable in member var
authorPhilipp Schüle <p.schuele@metaways.de>
Tue, 29 Apr 2014 13:43:03 +0000 (15:43 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Tue, 29 Apr 2014 14:38:23 +0000 (16:38 +0200)
... as this works better without a session

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

index 601ff75..e1d1b65 100644 (file)
@@ -6,7 +6,7 @@
  * @subpackage  Controller
  * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
  * @author      Lars Kneschke <l.kneschke@metaways.de>
- * @copyright   Copyright (c) 2008-2013 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @copyright   Copyright (c) 2008-2014 Metaways Infosystems GmbH (http://www.metaways.de)
  *
  * @todo        move $this->_db calls to backend class
  */
@@ -60,6 +60,13 @@ class Setup_Controller
     protected $_updatedApplications = 0;
     
     /**
+     * is filesystem available
+     * 
+     * @var boolean
+     */
+    protected $_isFileSystemAvailable = null;
+    
+    /**
      * don't clone. Use the singleton.
      *
      */
@@ -1812,16 +1819,21 @@ class Setup_Controller
      */
     public function isFilesystemAvailable()
     {
-        $session = Tinebase_Core::getSession();
-        if (! isset($session->filesystemAvailable)) {
-            $result = (! empty(Tinebase_Core::getConfig()->filesdir) && is_writeable(Tinebase_Core::getConfig()->filesdir));
-            if (is_object($session) && Zend_Session::isWritable()) {
-                $session->filesystemAvailable = $result;
+        if ($this->_isFileSystemAvailable === null) {
+            $session = Tinebase_Core::getSession();
+            if (! isset($session->filesystemAvailable)) {
+                $this->_isFileSystemAvailable = (! empty(Tinebase_Core::getConfig()->filesdir) && is_writeable(Tinebase_Core::getConfig()->filesdir));
+                if (is_object($session) && Zend_Session::isWritable()) {
+                    $session->filesystemAvailable = $result;
+                }
+                if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) Setup_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ 
+                    . ' Filesystem available: ' . ($result ? 'yes' : 'no'));
+                
+            } else {
+                $this->_isFileSystemAvailable = $session->filesystemAvailable;
             }
-        } else {
-            $result = $session->filesystemAvailable;
         }
         
-        return $result;
+        return $this->_isFileSystemAvailable;
     }
 }