Skip to content

Commit 8317cb6

Browse files
committed
wip
1 parent 6974da6 commit 8317cb6

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

modules/Core/classes/Tasks/Upgrade.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public function run(): string
1717
// Acquire lock to prevent concurrent upgrades
1818
$this->acquireLock();
1919

20+
Settings::set('maintenance', '1');
21+
2022
$updateCheck = $this->validateUpdateAvailable();
2123

2224
$upgradeZipPath = $this->downloadUpgradePackage($updateCheck);
@@ -27,15 +29,15 @@ public function run(): string
2729

2830
Settings::set('nameless_version', $updateCheck->versionTag());
2931
Settings::set('version_update', null);
30-
31-
$this->deleteUpgradeZip($upgradeZipPath);
3232
} catch (Exception $e) {
3333
$this->setOutput(['error' => $e->getMessage()]);
3434

3535
return Task::STATUS_FAILED;
3636
} finally {
3737
// Ensure the lock is released even if an error occurs
3838
$this->releaseLock();
39+
40+
Settings::set('maintenance', '0');
3941
}
4042

4143
return Task::STATUS_COMPLETED;
@@ -114,6 +116,10 @@ public function extractUpgradePackage(string $upgradeZipPath): void
114116
}
115117

116118
$zip->close();
119+
120+
// Remove the zip file after extraction
121+
unlink($upgradeZipPath);
122+
117123
$this->setOutput(['zip_extract' => 'Upgrade package extracted successfully']);
118124
}
119125

@@ -167,15 +173,6 @@ private function executeMigrations(): void
167173
]);
168174
}
169175

170-
private function deleteUpgradeZip(string $upgradeZipPath): void
171-
{
172-
if (file_exists($upgradeZipPath) && !unlink($upgradeZipPath)) {
173-
$this->setOutput(['delete_upgrade_zip' => 'Could not delete upgrade zip file']);
174-
} else {
175-
$this->setOutput(['delete_upgrade_zip' => 'Upgrade zip file deleted successfully']);
176-
}
177-
}
178-
179176
private function getTempDirectory(): string
180177
{
181178
$tmpDir = ini_get('upload_tmp_dir');

0 commit comments

Comments
 (0)