Commit 9bbe405bbe05b554556db074122afdb19d554daf

Authored by conradverm
1 parent 132a1ea2

KTS-2122

"Cannot restore a backup done in Commercial 3.3.7, commercial 3.4 looks for the back in a different directory"
Fixed. Can now specify backup/mysqlDirectory to find mysqldump. Also, backups must be located in default or backup/backupDirectory.

Reviewed By: Kevin Fourie

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@6828 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 16 additions and 11 deletions
setup/upgrade.php
@@ -295,10 +295,7 @@ function loginFailed($message) @@ -295,10 +295,7 @@ function loginFailed($message)
295 } 295 }
296 296
297 function resolveMysqlDir() 297 function resolveMysqlDir()
298 -{  
299 -  
300 -  
301 - 298 +{
302 // possibly detect existing installations: 299 // possibly detect existing installations:
303 300
304 if (OS_UNIX) 301 if (OS_UNIX)
@@ -310,15 +307,18 @@ function resolveMysqlDir() @@ -310,15 +307,18 @@ function resolveMysqlDir()
310 { 307 {
311 $dirs = explode(';', $_SERVER['PATH']); 308 $dirs = explode(';', $_SERVER['PATH']);
312 $dirs[] ='c:/Program Files/MySQL/MySQL Server 5.0/bin'; 309 $dirs[] ='c:/Program Files/MySQL/MySQL Server 5.0/bin';
  310 + $dirs[] = 'c:/program files/ktdms/mysql/bin';
313 $mysqlname ='mysql.exe'; 311 $mysqlname ='mysql.exe';
314 } 312 }
315 313
  314 + $oKTConfig =& KTConfig::getSingleton();
  315 + $mysqldir = $oKTConfig->get('backup/mysqlDirectory',$mysqldir);
  316 + $dirs[] = $mysqldir;
316 317
317 -  
318 - if (strpos(__FILE__,'knowledgeTree') !== false && strpos(__FILE__,'ktdms')) 318 + if (strpos(__FILE__,'knowledgeTree') !== false && strpos(__FILE__,'ktdms') != false)
319 { 319 {
320 $dirs [] = realpath(dirname($FILE) . '/../../mysql/bin'); 320 $dirs [] = realpath(dirname($FILE) . '/../../mysql/bin');
321 - } 321 + }
322 322
323 foreach($dirs as $dir) 323 foreach($dirs as $dir)
324 { 324 {
@@ -435,7 +435,7 @@ function resolveTempDir() @@ -435,7 +435,7 @@ function resolveTempDir()
435 $dir='c:/kt-db-backup'; 435 $dir='c:/kt-db-backup';
436 } 436 }
437 $oKTConfig =& KTConfig::getSingleton(); 437 $oKTConfig =& KTConfig::getSingleton();
438 - $dir = $oKTConfig->get('backups/backupDirectory',$dir); 438 + $dir = $oKTConfig->get('backup/backupDirectory',$dir);
439 439
440 if (!is_dir($dir)) 440 if (!is_dir($dir))
441 { 441 {
@@ -496,7 +496,7 @@ Your mysql installation has been resolved. Manually, you would do the following: @@ -496,7 +496,7 @@ Your mysql installation has been resolved. Manually, you would do the following:
496 else 496 else
497 { 497 {
498 ?> 498 ?>
499 -It appears as though you are not using the stack installer, or are using a custom install. 499 +The mysql backup utility could not be found automatically. Either do a manual backup, or edit the config.ini and update the backup/mysqlDirectory entry.
500 <P> 500 <P>
501 You can continue to do the backup manually using the following process: 501 You can continue to do the backup manually using the following process:
502 <P> 502 <P>
@@ -638,7 +638,7 @@ Manually, you would do the following to restore the backup: @@ -638,7 +638,7 @@ Manually, you would do the following to restore the backup:
638 else 638 else
639 { 639 {
640 ?> 640 ?>
641 -It appears as though you are not using the stack installer, or are using a custom install. 641 +The mysql backup utility could not be found automatically. Either do a manual restore, or edit the config.ini and update the backup/mysqlDirectory entry.
642 <P> 642 <P>
643 You can continue to do the restore manually using the following command(s): 643 You can continue to do the restore manually using the following command(s):
644 <P> 644 <P>
@@ -718,7 +718,7 @@ function backupDone() @@ -718,7 +718,7 @@ function backupDone()
718 else 718 else
719 { 719 {
720 ?> 720 ?>
721 - It appears as though you are not using the stack installer, or are using a custom install. 721 + The mysql backup utility could not be found automatically. Please edit the config.ini and update the backup/mysqlDirectory entry.
722 <P> 722 <P>
723 If you need to restore from this backup, you should be able to use the following statements: 723 If you need to restore from this backup, you should be able to use the following statements:
724 <P> 724 <P>
@@ -861,6 +861,11 @@ function backup() @@ -861,6 +861,11 @@ function backup()
861 $dir=resolveTempDir(); 861 $dir=resolveTempDir();
862 $_SESSION['backupFile'] = $stmt['target']; 862 $_SESSION['backupFile'] = $stmt['target'];
863 863
  864 + if (OS_UNIX)
  865 + {
  866 + chmod($stmt['target'],0600);
  867 + }
  868 +
864 if (is_file($stmt['target']) && filesize($stmt['target']) > 0) 869 if (is_file($stmt['target']) && filesize($stmt['target']) > 0)
865 { 870 {
866 $_SESSION['backupStatus'] = true; 871 $_SESSION['backupStatus'] = true;