- $data = json_decode($response, true);
- return $data['update_available'] ?? false;
-}
-
-// Function to download the update
-function downloadUpdate($url, $savePath) {
- $ch = curl_init($url);
- $fp = fopen($savePath, 'w+');
-
- curl_setopt($ch, CURLOPT_FILE, $fp);
- curl_setopt($ch, CURLOPT_TIMEOUT, 60);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
-
- $success = curl_exec($ch);
-
- curl_close($ch);
- fclose($fp);
-
- return $success;
-}
+ function cleanupOldFiles()
+ {
+ $currentFiles = $this->listFiles($this->web_dir);
+ $updateFiles = $this->listFiles($this->temp_dir);
+
+ $filesToDelete = array_diff($currentFiles, $updateFiles);
+
+ foreach ($filesToDelete as $file)
+ {
+ error_log($file);
+ //unlink("$b$file");
+ }