-<?php
+<?php declare(strict_types=1);
namespace Cli\Commands;
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
$this->withOwnBookStackFolder(function (string $basePath) {
exec("rm -rf $basePath/vendor");
file_put_contents("$basePath/version", 'v25.02');
+ file_put_contents("$basePath/bootstrap/cache/packages.php", 'cat');
+ file_put_contents("$basePath/bootstrap/cache/services.php", 'dog');
@mkdir("$basePath/dev/checksums", 0777, true);
file_put_contents("$basePath/dev/checksums/vendor", '22e02ee72d21ff719c1073abbec8302f8e2096ba6d072e133051064ed24b45b1');
$result->assertStdoutContains('Successfully downloaded & extracted vendor files into BookStack instance!');
$this->assertDirectoryExists("$basePath/vendor/composer");
+ $this->assertFileDoesNotExist("$basePath/bootstrap/cache/packages.php");
+ $this->assertFileDoesNotExist("$basePath/bootstrap/cache/services.php");
});
}