Skip to content

Commit

Permalink
Restore config backup when extracting core files fails
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <[email protected]>
  • Loading branch information
sampoyigi committed Dec 31, 2023
1 parent 638836e commit 1ddc4ac
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions app/system/classes/UpdateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,7 @@ public function requestUpdateList($force = false)
$update['installedVer'] = params('ti_version');
if ($this->disableCoreUpdates)
continue;
}
else {
} else {
if ($this->isMarkedAsIgnored($update['code'])) {
$ignoredItems[] = $update;
continue;
Expand Down Expand Up @@ -516,10 +515,12 @@ public function extractCore($fileCode)
$configBackup = base_path('/config-backup');
File::moveDirectory($configDir, $configBackup);

$result = $this->extractFile($fileCode);

File::copyDirectory($configBackup, $configDir);
File::deleteDirectory($configBackup);
try {
$result = $this->extractFile($fileCode);
} finally {
File::copyDirectory($configBackup, $configDir);
File::deleteDirectory($configBackup);
}

return $result;
}
Expand Down

0 comments on commit 1ddc4ac

Please sign in to comment.