fixes some minor problems in abstract update class
authorPhilipp Schüle <p.schuele@metaways.de>
Wed, 15 Jul 2015 11:23:43 +0000 (13:23 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 15 Jul 2015 16:36:55 +0000 (18:36 +0200)
Change-Id: Iff31a4042a438b93892ad3e93c2dea3ab3ab5806
Reviewed-on: http://gerrit.tine20.com/customers/2035
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Setup/Exception/PromptUser.php
tine20/Setup/Update/Abstract.php

index c881d9f..c7cb7f5 100644 (file)
@@ -18,7 +18,7 @@
  */
 class Setup_Exception_PromptUser extends Setup_Exception
 {
-    public function __construct($_message, $_code) {
-        parent::__construct('This update could be run from cli only!', 901);
+    public function __construct($_message, $_code = 901) {
+        parent::__construct('This update could be run from cli only!', $_code);
     }
 }
index addb2be..599dd7b 100644 (file)
@@ -87,11 +87,12 @@ class Setup_Update_Abstract
                 ->where(    $this->_db->quoteIdentifier('name') . ' = ?', $_tableName)
                 ->orwhere(  $this->_db->quoteIdentifier('name') . ' = ?', SQL_TABLE_PREFIX . $_tableName);
 
+        if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ .
+            ' ' . $select->__toString());
+
         $stmt = $select->query();
         $rows = $stmt->fetchAll();
-        
-        //if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . $select->__toString());
-        
+
         $result = (count($rows) > 0 && isset($rows[0]['version'])) ? $rows[0]['version'] : 0;
         
         return $result;
@@ -233,7 +234,7 @@ class Setup_Update_Abstract
                 try {
                     if ($userFound === FALSE) {
                         echo PHP_EOL;
-                        echo 'The user "' . $user . '" could not be found!' . PHP_EOL . PHP_EOL;
+                        echo 'The user could not be found!' . PHP_EOL . PHP_EOL;
                     }
                     
                     $user = Tinebase_Server_Cli::promptInput('Please enter an admin username to perform updates ');
@@ -255,7 +256,7 @@ class Setup_Update_Abstract
             } while (! $userFound);
             
         } else {
-            throw new Setup_Exception_PromptUser();
+            throw new Setup_Exception_PromptUser('no CLI call');
         }
         
         return $userAccount;