From 6e8bcf7b69fd53ae051539c513cbae16501ad45a Mon Sep 17 00:00:00 2001 From: Thomas Casteleyn Date: Fri, 22 Mar 2019 16:02:17 +0100 Subject: [PATCH] Make setup backup location and name similar as other backups (#61) --- setup/setuputils.class.inc.php | 14 ++++++++++++-- setup/wizardsteps.class.inc.php | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/setup/setuputils.class.inc.php b/setup/setuputils.class.inc.php index 874116d17..1e186b9fa 100644 --- a/setup/setuputils.class.inc.php +++ b/setup/setuputils.class.inc.php @@ -460,11 +460,12 @@ class SetupUtils /** * Check that the backup could be executed - * @param $sDestDir + * @param $sDBBackupPath + * @param $sMySQLBinDir * @return array An array of CheckResults objects * @internal param Page $oP The page used only for its 'log' method */ - static function CheckBackupPrerequisites($sDestDir, $sMySQLBinDir = null) + static function CheckBackupPrerequisites($sDBBackupPath, $sMySQLBinDir = null) { $aResult = array(); SetupPage::log('Info - CheckBackupPrerequisites'); @@ -529,6 +530,15 @@ class SetupUtils { SetupPage::log('Info - mysqldump -V said: '.$sLine); } + + // create and test destination location + // + $sDestDir = dirname($sDBBackupPath); + setuputils::builddir($sDestDir); + if (!is_dir($sDestDir)) + { + $aResult[] = new CheckResult(CheckResult::ERROR, "$sDestDir does not exist and could not be created."); + } // check disk space // to do... evaluate how we can correlate the DB size with the size of the dump (and the zip!) diff --git a/setup/wizardsteps.class.inc.php b/setup/wizardsteps.class.inc.php index cd94f3629..f01ef00f7 100644 --- a/setup/wizardsteps.class.inc.php +++ b/setup/wizardsteps.class.inc.php @@ -220,7 +220,7 @@ class WizStepInstallOrUpgrade extends WizardStep $sPreviousVersionDir = ''; if ($sInstallMode == '') { - $sDBBackupPath = APPROOT.'data/'.ITOP_APPLICATION.strftime('-backup-%Y-%m-%d'); + $sDBBackupPath = APPROOT.strftime('data/backups/manual/setup-%Y-%m-%d_%H_%M'); $bDBBackup = true; $aPreviousInstance = SetupUtils::GetPreviousInstance(APPROOT); if ($aPreviousInstance['found'])