Merge branch '2014.11-develop' into 2015.07
authorPhilipp Schüle <p.schuele@metaways.de>
Mon, 14 Sep 2015 15:01:44 +0000 (17:01 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 14 Sep 2015 15:01:44 +0000 (17:01 +0200)
Conflicts:
tests/tine20/Tinebase/AllTests.php
tine20/Tinebase/Core.php
tine20/Tinebase/translations/de.po

Change-Id: I82a8c5edfaf830c9a56fd39f56106dacae74f9be

1  2 
tests/tine20/Tinebase/AllTests.php
tine20/Calendar/Convert/Event/Json.php
tine20/Tinebase/Controller/Record/Abstract.php
tine20/Tinebase/Core.php
tine20/Tinebase/Frontend/Http.php
tine20/Tinebase/Frontend/Json.php
tine20/Tinebase/Helper.php
tine20/Tinebase/User.php
tine20/Tinebase/translations/de.po

@@@ -69,8 -68,8 +69,9 @@@ class Tinebase_AllTest
          $suite->addTestSuite('Tinebase_Redis_QueueTest');
          $suite->addTestSuite('Tinebase_Pluggable_ConcreteTest');
          $suite->addTestSuite('Tinebase_TempFileTest');
-         
 +        $suite->addTestSuite('Tinebase_Server_AllTests');
+         $suite->addTestSuite('Tinebase_LockTest');
          $suite->addTest(Tinebase_User_AllTests::suite());
          $suite->addTest(Tinebase_Group_AllTests::suite());
          $suite->addTest(Tinebase_Timemachine_AllTests::suite());
@@@ -1541,81 -1628,43 +1541,122 @@@ class Tinebase_Cor
      }
  
      /**
-            self::$_serverPlugins = self::_searchServerPlugins();
 +     * Search server plugins from applications configuration
 +     *
 +     */
 +    protected static function _searchServerPlugins()
 +    {
 +        $cache = Tinebase_Core::getCache();
 +        
 +        if ($cache &&
 +            $plugins = $cache->load(self::TINEBASE_SERVER_PLUGINS)
 +        ) {
 +            return $plugins;
 +        }
 +        
 +        // get list of available applications
 +        $applications = array();
 +        
 +        $d = dir(realpath(__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();
 +        
 +        // get list of plugins
 +        $plugins = array();
 +        
 +        foreach ($applications as $application) {
 +            $config = $application . '_Config';
 +            
 +            try {
 +                if (class_exists($config)) {
 +                    $reflectedClass = new ReflectionClass($config);
 +                    
 +                    if ($reflectedClass->isSubclassOf('Tinebase_Config_Abstract')) {
 +                        $plugins = array_merge(
 +                            $plugins,
 +                            call_user_func(array($config,'getServerPlugins'))
 +                        );
 +                    }
 +                }
 +            } catch (Exception $e) {
 +                Tinebase_Exception::log($e);
 +            }
 +        }
 +        
 +        // sort plugins by priority
 +        asort($plugins);
 +        
 +        $plugins = array_keys($plugins);
 +        
 +        if ($cache) {
 +            $cache->save($plugins, self::TINEBASE_SERVER_PLUGINS);
 +        }
 +        
 +        return $plugins;
 +    }
 +
 +    /**
 +     * Return server plugins ensuring that they were found
 +     *
 +     * @return array
 +     */
 +    protected static function _getServerPlugins()
 +    {
 +        if (empty(self::$_serverPlugins)) {
-         
++            self::$_serverPlugins = self::_searchServerPlugins();
 +        }
++
 +        return self::$_serverPlugins;
 +    }
++
++    /**
+      * returns TRUE if filesystem is available
+      *
+      *  - value is stored in session and registry for caching
+      *
+      * @return boolean
+      */
+     public static function isFilesystemAvailable()
+     {
+         $isFileSystemAvailable = self::get('FILESYSTEM');
+         if ($isFileSystemAvailable === null) {
+             try {
+                 $session = Tinebase_Session::getSessionNamespace();
+                 if (isset($session->filesystemAvailable)) {
+                     $isFileSystemAvailable = $session->filesystemAvailable;
+                     self::set('FILESYSTEM', $isFileSystemAvailable);
+                     return $isFileSystemAvailable;
+                 }
+             } catch (Zend_Session_Exception $zse) {
+                 $session = null;
+             }
+             $isFileSystemAvailable = (!empty(Tinebase_Core::getConfig()->filesdir) && is_writeable(Tinebase_Core::getConfig()->filesdir));
+             if ($session instanceof Zend_Session_Namespace) {
+                 if (Tinebase_Session::isWritable()) {
+                     $session->filesystemAvailable = $isFileSystemAvailable;
+                 }
+             }
+             if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__
+                 . ' Filesystem available: ' . ($isFileSystemAvailable ? 'yes' : 'no'));
+             self::set('FILESYSTEM', $isFileSystemAvailable);
+         }
+         return $isFileSystemAvailable;
+     }
  }
Simple merge
Simple merge
@@@ -54,31 -54,19 +54,20 @@@ class Tinebase_Helpe
       * - for example: 50M -> 52428800
       *
       * @param mixed $_value
 -     * @return integer
 +     * @return int
 +     * @throws Exception
       */
-     public static function convertToBytes($_value)
+     public static function convertToBytes($value)
      {
-         if (is_int($_value) || ! $_value) {
-             $bytes = $_value;
-         } else {
-             if (preg_match("/M/", $_value)) {
-                 $value = substr($_value, 0, strpos($_value, 'M'));
-                 $factor = 1024 * 1024;
-             } elseif (preg_match("/K/", $_value)) {
-                 $value = substr($_value, 0, strpos($_value, 'K'));
-                 $factor = 1024;
-             } elseif (is_string($_value)) {
-                 $value = $_value;
-                 $factor = 1;
-             } else {
-                 throw new Exception('Argument type not supported:' . gettype($_value));
-             }
-             
-             $bytes = intval($value) * $factor;
+         $powers = 'KMGTPEZY';
+         $power = 0;
+         if (preg_match('/(\d+)\s*([' . $powers . '])/', $value, $matches)) {
+             $value = $matches[1];
+             $power = strpos($powers, $matches[2]) + 1;
          }
-         
-         return $bytes;
+         return (int)$value * pow(1024, $power);
      }
      
      /**
Simple merge
@@@ -3154,92 -3337,9 +3154,96 @@@ msgstr "Erlaubt es zu konfigurieren wel
  msgid "Max username length"
  msgstr "Maximale Benutzernamen Länge"
  
 -#~ msgid "- The last filter I used -"
 -#~ msgstr "- Der zuletzt benutzte Filter -"
 +#: Import/Csv/Abstract.php:206
 +#, python-format
 +msgid "The following fields weren't imported: %s"
 +msgstr "Die folgenden Felder wurden nicht importiert: %s"
 +
 +#: Import/Csv/Abstract.php:207
 +msgid "N/A"
 +msgstr "n.v."
 +
 +#: Exception.php:49
 +#, python-brace-format
 +msgid "Exception ({0})"
 +msgstr "Ausnahmefehler ({0})"
 +
 +#: WebDav/PrincipalBackend.php:549
 +msgid "Shared folders"
 +msgstr "Gemeinsame Ordner"
 +
 +#: Setup/setup.xml:3421
 +msgid "note"
 +msgstr "Notiz"
 +
 +#: Setup/setup.xml:3426
 +msgid "default note type"
 +msgstr "default note type"
 +
 +#: Setup/setup.xml:3452
 +msgid "telephone"
 +msgstr "Telefon"
 +
 +#: Setup/setup.xml:3457
 +msgid "telephone call"
 +msgstr "Telefonanruf"
 +
 +#: Setup/setup.xml:3483
 +msgid "email"
 +msgstr "E-Mail"
 +
 +#: Setup/setup.xml:3488
 +msgid "email contact"
 +msgstr "E-Mail Kontakt"
 +
 +#: Setup/setup.xml:3514
 +msgid "created"
 +msgstr "erstellt"
 +
 +#: Setup/setup.xml:3519
 +msgid "record created"
 +msgstr "Eintrag erstellt"
 +
 +#: Setup/setup.xml:3545
 +msgid "changed"
 +msgstr "geändert"
 +
 +#: Setup/setup.xml:3550
 +msgid "record changed"
 +msgstr "Eintrag geändert"
 +
 +#: views/update.php:24
 +msgid "Tine 2.0 needs to be updated or is not installed yet."
 +msgstr "Tine 2.0 muss aktualisiert werden oder ist noch nicht komplett installiert."
 +
 +#: views/update.php:25
 +msgid "Please wait or contact your administrator"
 +msgstr "Bitte warten Sie oder kontaktieren Sie den Administrator"
 +
 +#: views/deactivationNotification.php:11
 +msgid "Your user account has been deactivated"
 +msgstr "Ihr Benutzerkonto würde deaktiviert"
 +
 +#: views/deactivationNotification.php:13
 +msgid "Deactivation date"
 +msgstr "Deaktivierungsdatum"
 +
 +#: views/deactivationNotification.php:14
 +msgid "Tine 2.0 URL"
 +msgstr "Tine 2.0 URL"
 +
 +#: Record/RecordSetDiff.php:42
 +msgid "added"
 +msgstr "hinzugefügt"
 +
 +#: Record/RecordSetDiff.php:43
 +msgid "removed"
 +msgstr "entfernt"
 +
 +#: Record/RecordSetDiff.php:44
 +msgid "modified"
 +msgstr "geändert"
+ msgid "and"
+ msgstr "und"