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 295 }
296 296  
297 297 function resolveMysqlDir()
298   -{
299   -
300   -
301   -
  298 +{
302 299 // possibly detect existing installations:
303 300  
304 301 if (OS_UNIX)
... ... @@ -310,15 +307,18 @@ function resolveMysqlDir()
310 307 {
311 308 $dirs = explode(';', $_SERVER['PATH']);
312 309 $dirs[] ='c:/Program Files/MySQL/MySQL Server 5.0/bin';
  310 + $dirs[] = 'c:/program files/ktdms/mysql/bin';
313 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 320 $dirs [] = realpath(dirname($FILE) . '/../../mysql/bin');
321   - }
  321 + }
322 322  
323 323 foreach($dirs as $dir)
324 324 {
... ... @@ -435,7 +435,7 @@ function resolveTempDir()
435 435 $dir='c:/kt-db-backup';
436 436 }
437 437 $oKTConfig =& KTConfig::getSingleton();
438   - $dir = $oKTConfig->get('backups/backupDirectory',$dir);
  438 + $dir = $oKTConfig->get('backup/backupDirectory',$dir);
439 439  
440 440 if (!is_dir($dir))
441 441 {
... ... @@ -496,7 +496,7 @@ Your mysql installation has been resolved. Manually, you would do the following:
496 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 500 <P>
501 501 You can continue to do the backup manually using the following process:
502 502 <P>
... ... @@ -638,7 +638,7 @@ Manually, you would do the following to restore the backup:
638 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 642 <P>
643 643 You can continue to do the restore manually using the following command(s):
644 644 <P>
... ... @@ -718,7 +718,7 @@ function backupDone()
718 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 722 <P>
723 723 If you need to restore from this backup, you should be able to use the following statements:
724 724 <P>
... ... @@ -861,6 +861,11 @@ function backup()
861 861 $dir=resolveTempDir();
862 862 $_SESSION['backupFile'] = $stmt['target'];
863 863  
  864 + if (OS_UNIX)
  865 + {
  866 + chmod($stmt['target'],0600);
  867 + }
  868 +
864 869 if (is_file($stmt['target']) && filesize($stmt['target']) > 0)
865 870 {
866 871 $_SESSION['backupStatus'] = true;
... ...