fixes some update scripts
authorPhilipp Schüle <p.schuele@metaways.de>
Thu, 1 Jun 2017 11:53:54 +0000 (13:53 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 1 Jun 2017 16:10:23 +0000 (18:10 +0200)
* and favorite prop is no longer mandatory
 for ImportExportDefinitions

Change-Id: I320a3f8b88f47728a10d9382f7d925a89eb69dcc
Reviewed-on: http://gerrit.tine20.com/customers/4798
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Addressbook/Setup/Update/Release10.php
tine20/Tinebase/Model/ImportExportDefinition.php
tine20/Tinebase/Setup/Update/Release10.php

index 2bf2075..ddbd987 100644 (file)
@@ -91,16 +91,15 @@ class Addressbook_Setup_Update_Release10 extends Setup_Update_Abstract
     {
         $addressbookApplication = Tinebase_Application::getInstance()->getApplicationByName('Addressbook');
         $definitionDirectory = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Export' . DIRECTORY_SEPARATOR . 'definitions' . DIRECTORY_SEPARATOR;
-        $files = array(
-            'adb_pdf.xml',
-            'adb_csv.xml',
-            'adb_ods.xml',
-            'adb_xls.xml',
-            'adb_doc.xml'
-        );
 
-        foreach($files as $file) {
-            Tinebase_ImportExportDefinition::getInstance()->updateOrCreateFromFilename($definitionDirectory . $file, $addressbookApplication);
+        $dir = new DirectoryIterator($definitionDirectory);
+        foreach ($dir as $fileinfo) {
+            if ($fileinfo->isFile()) {
+                Tinebase_ImportExportDefinition::getInstance()->updateOrCreateFromFilename(
+                    $fileinfo->getPath() . '/' . $fileinfo->getFilename(),
+                    $addressbookApplication
+                );
+            }
         }
 
         $this->setApplicationVersion('Addressbook', '10.5');
index 7ca2ab7..b4974c5 100644 (file)
@@ -65,7 +65,7 @@ class Tinebase_Model_ImportExportDefinition extends Tinebase_Record_Abstract
             'presence'                      => 'required',
             array('InArray', array('import', 'export', 'letter'))
         ),
-        'favorite'              => array(Zend_Filter_Input::ALLOW_EMPTY => false,   'presence' => 'required', 'default' => true),
+        'favorite'              => array(Zend_Filter_Input::ALLOW_EMPTY => true,    'default' => true),
         'order'                 => array(Zend_Filter_Input::ALLOW_EMPTY => false,   'presence' => 'required', 'default' => 0),
         'icon_class'            => array(Zend_Filter_Input::ALLOW_EMPTY => true),
         'plugin'                => array(Zend_Filter_Input::ALLOW_EMPTY => false,   'presence' => 'required'),
index 8d27fde..96e63b8 100644 (file)
@@ -423,13 +423,21 @@ class Tinebase_Setup_Update_Release10 extends Setup_Update_Abstract
 
         $this->createTable('path', $declaration, 'Tinebase', 2);
 
-        $setupUser = Setup_Update_Abstract::getSetupFromConfigOrCreateOnTheFly();
-        if ($setupUser) {
-            Tinebase_Core::set(Tinebase_Core::USER, $setupUser);
-            Tinebase_Controller::getInstance()->rebuildPaths();
-        } else {
-            if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__
-                . ' Could not find valid setupuser. Skipping rebuildPaths: you might need to run this manually.');
+        try {
+            $setupUser = Setup_Update_Abstract::getSetupFromConfigOrCreateOnTheFly();
+            if ($setupUser) {
+                Tinebase_Core::set(Tinebase_Core::USER, $setupUser);
+                Tinebase_Controller::getInstance()->rebuildPaths();
+            } else {
+                if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) {
+                    Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__
+                        . ' Could not find valid setupuser. Skipping rebuildPaths: you might need to run this manually.');
+                }
+            }
+        } catch (Exception $e) {
+            Tinebase_Exception::log($e);
+            Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__
+                . ' Skipping rebuildPaths: you might need to run this manually.');
         }
 
         $this->setApplicationVersion('Tinebase', '10.10');