improves Tinebase ID detection for install_dump
authorPhilipp Schüle <p.schuele@metaways.de>
Thu, 13 Jul 2017 08:13:30 +0000 (10:13 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 13 Jul 2017 09:55:41 +0000 (11:55 +0200)
* and sets default port for mysql backup/restore

Change-Id: I810fa31d16afc94a618f6d4259e8974e087ba14d
Reviewed-on: http://gerrit.tine20.com/customers/5141
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Setup/Backend/Mysql.php
tine20/Setup/Controller.php

index b857577..ff97044 100644 (file)
@@ -476,10 +476,12 @@ class Setup_Backend_Mysql extends Setup_Backend_Abstract
      */
     protected function _createMyConf($path, $config)
     {
+        $port = $config->port ? $config->port : 3306;
+
         $mycnfData = <<<EOT
 [client]
 host = {$config->host}
-port = {$config->port}
+port = {$port}
 user = {$config->username}
 password = {$config->password}
 EOT;
index bbb4ba9..f601920 100644 (file)
@@ -1517,12 +1517,13 @@ class Setup_Controller
     protected function _replaceTinebaseidInDump($mysqlBackupFile)
     {
         // fetch old Tinebase ID
-        $cmd = "bzcat $mysqlBackupFile | grep \",'Tinebase',\"";
+        $cmd = "bzcat $mysqlBackupFile | grep \",'Tinebase','enabled'\"";
         $result = exec($cmd);
         if (! preg_match("/'([0-9a-f]+)','Tinebase'/", $result, $matches)) {
             throw new Setup_Exception('could not find Tinebase ID in dump');
         }
         $oldTinebaseId = $matches[1];
+        Setup_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Replacing old Tinebase id: ' . $oldTinebaseId);
 
         $cmd = "bzcat $mysqlBackupFile | sed s/"
             . $oldTinebaseId . '/'