@@ -17,6 +17,8 @@ public function run(): string
17
17
// Acquire lock to prevent concurrent upgrades
18
18
$ this ->acquireLock ();
19
19
20
+ Settings::set ('maintenance ' , '1 ' );
21
+
20
22
$ updateCheck = $ this ->validateUpdateAvailable ();
21
23
22
24
$ upgradeZipPath = $ this ->downloadUpgradePackage ($ updateCheck );
@@ -27,15 +29,15 @@ public function run(): string
27
29
28
30
Settings::set ('nameless_version ' , $ updateCheck ->versionTag ());
29
31
Settings::set ('version_update ' , null );
30
-
31
- $ this ->deleteUpgradeZip ($ upgradeZipPath );
32
32
} catch (Exception $ e ) {
33
33
$ this ->setOutput (['error ' => $ e ->getMessage ()]);
34
34
35
35
return Task::STATUS_FAILED ;
36
36
} finally {
37
37
// Ensure the lock is released even if an error occurs
38
38
$ this ->releaseLock ();
39
+
40
+ Settings::set ('maintenance ' , '0 ' );
39
41
}
40
42
41
43
return Task::STATUS_COMPLETED ;
@@ -114,6 +116,10 @@ public function extractUpgradePackage(string $upgradeZipPath): void
114
116
}
115
117
116
118
$ zip ->close ();
119
+
120
+ // Remove the zip file after extraction
121
+ unlink ($ upgradeZipPath );
122
+
117
123
$ this ->setOutput (['zip_extract ' => 'Upgrade package extracted successfully ' ]);
118
124
}
119
125
@@ -167,15 +173,6 @@ private function executeMigrations(): void
167
173
]);
168
174
}
169
175
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
-
179
176
private function getTempDirectory (): string
180
177
{
181
178
$ tmpDir = ini_get ('upload_tmp_dir ' );
0 commit comments