]> BookStack Code Mirror - system-cli/blobdiff - src/Commands/DownloadVendorCommand.php
Download Vendor: Added packages to cleanup files
[system-cli] / src / Commands / DownloadVendorCommand.php
index 7c18fed653aed596befc15389256897fbd2afe9f..d3b0501d6efa47167a4084f429132ab8e62a0585 100644 (file)
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 
 namespace Cli\Commands;
 
@@ -65,12 +65,22 @@ class DownloadVendorCommand extends Command
 
     protected function cleanupAppServices(string $appDir): bool
     {
-        $servicesFile = implode(DIRECTORY_SEPARATOR, [$appDir, 'bootstrap', 'cache', 'services.php']);
-        if (file_exists($servicesFile)) {
-            return @unlink($servicesFile);
+        $filesToClear = [
+            implode(DIRECTORY_SEPARATOR, [$appDir, 'bootstrap', 'cache', 'services.php']),
+            implode(DIRECTORY_SEPARATOR, [$appDir, 'bootstrap', 'cache', 'packages.php']),
+        ];
+
+        $status = true;
+
+        foreach ($filesToClear as $file) {
+            if (file_exists($file)) {
+                if (@unlink($file) === false) {
+                    $status = false;
+                }
+            }
         }
 
-        return true;
+        return $status;
     }
 
     protected function extractZip(string $zipPath, string $appDir): void