Skip to content

Commit

Permalink
PATCH: fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnysideup committed Apr 24, 2019
1 parent 660474e commit 044d262
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions code/model/DatabasebackupLog.php
Expand Up @@ -155,13 +155,11 @@ public function onBeforeWrite()
if ($fileLocation = $this->getFullLocationWithExtension()) {
$fileLocation = $this->cycleDatabaseBackupFiles($fileLocation);
global $databaseConfig;
print_r($databaseConfig);
die('asdf');
$compression = $this->Config()->get("compression");
if ($compression == "gzip") {
$command = "mysqldump -u ".$databaseConfig["username"]." -p".$databaseConfig["password"]." ".$databaseConfig["database"]." | gzip > ".$fileLocation;
$command = "mysqldump -u ".$databaseConfig["username"]." -p".$databaseConfig["password"]." -h ".$databaseConfig["server"]." ".$databaseConfig["database"]." | gzip > ".$fileLocation;
} else {
$command = "mysqldump -u ".$databaseConfig["username"]." -p".$databaseConfig["password"]." ".$databaseConfig["database"]." > ".$fileLocation;
$command = "mysqldump -u ".$databaseConfig["username"]." -p".$databaseConfig["password"]." -h ".$databaseConfig["server"]." ".$databaseConfig["database"]." > ".$fileLocation;
}
$this->DebugMessage = exec($command);
$this->FullLocation = $fileLocation;
Expand Down Expand Up @@ -217,9 +215,9 @@ public function restoreDatabaseBackup()
global $databaseConfig;
$compression = $this->Config()->get("compression");
if ($compression == "gzip") {
$command = "gunzip < ".$fileLocation. " | mysql -u ".$databaseConfig["username"]." -p".$databaseConfig["password"]." ".$databaseConfig["database"]." ";
$command = "gunzip < ".$fileLocation. " | mysql -u ".$databaseConfig["username"]." -p".$databaseConfig["password"]." -h ".$databaseConfig["server"]." ".$databaseConfig["database"]." ";
} else {
$command = "mysql -u ".$databaseConfig["username"]." -p".$databaseConfig["password"]." ".$databaseConfig["database"]." < ".$fileLocation;
$command = "mysql -u ".$databaseConfig["username"]." -p".$databaseConfig["password"]." -h ".$databaseConfig["server"]." ".$databaseConfig["database"]." < ".$fileLocation;
}
exec($command);
//reset list of backups ...
Expand Down

0 comments on commit 044d262

Please sign in to comment.