Skip to content

Commit

Permalink
Fix restore
Browse files Browse the repository at this point in the history
  • Loading branch information
Commifreak committed Dec 27, 2022
1 parent 48fa524 commit 50d8423
Showing 2 changed files with 16 additions and 7 deletions.
9 changes: 7 additions & 2 deletions ca.backup2.plg
Original file line number Diff line number Diff line change
@@ -2,8 +2,8 @@
<!DOCTYPE PLUGIN [
<!ENTITY name "ca.backup2">
<!ENTITY author "Robin Kluth">
<!ENTITY version "2022.12.22">
<!ENTITY md5 "cb3956c01906cb3ec0e979e6675b9657">
<!ENTITY version "2022.12.27">
<!ENTITY md5 "29229aedd91d96e8531e6f50b6f176c4">
<!ENTITY launch "Settings/BackupMainV2">
<!ENTITY plugdir "/usr/local/emhttp/plugins/&name;">
<!ENTITY github "Commifreak/ca.backup2">
@@ -13,6 +13,10 @@
<PLUGIN name="&name;" author="&author;" version="&version;" launch="&launch;" pluginURL="&pluginURL;" icon="shield">

<CHANGES>
<![CDATA[
##2022.12.27
- Fixed restore
##2022.12.22
- Added some debug infos for the "Already started" docker issue
- Fixes "Abort" function
@@ -118,6 +122,7 @@ version.
###2017.11.05
- Initial Release
]]>
</CHANGES>

<!-- The 'pre-install' script. -->
Original file line number Diff line number Diff line change
@@ -209,7 +209,11 @@ function backupLog($msg, $newLine = true, $skipDate = false)

$logLine = $restore ? "Restoring" : "Backing Up";
$fileExt = ($backupOptions['compression']) == "yes" ? ".tar.gz" : ".tar";
backupLog("$logLine appData from $source to $destination");
if($restore) {
backupLog("$logLine appData from $restoreSource to $restoreDestination");
} else {
backupLog("$logLine appData from $source to $destination");
}

if (!$restore) {
if (is_dir($source)) {
@@ -249,7 +253,7 @@ function backupLog($msg, $newLine = true, $skipDate = false)
exec("mkdir -p " . escapeshellarg($restoreDestination));

foreach ($restoreItems as $item) {
if (in_array($item, ['.', '..'])) {
if (in_array($item, ($restore ? ['.', '..', 'backup.log'] : ['.', '..']))) {
// Ignore . and ..
continue;
}
@@ -271,13 +275,13 @@ function backupLog($msg, $newLine = true, $skipDate = false)

exec($command, $out, $returnValue);

if(!file_exists($communityPaths['backupProgress'])) {
backupLog("User aborted backup!");
if(!file_exists(($restore ? $communityPaths['restoreProgress'] : $communityPaths['backupProgress']))) {
backupLog("User aborted backup/restore!");
break;
}

if ($returnValue > 0) {
backupLog("tar creation failed!");
backupLog("tar creation/extraction failed!");
$errorOccured = true;
} else {
if (!$restore)

0 comments on commit 50d8423

Please sign in to comment.