diff --git a/src/Command/DeleteUnusedIndicesCommand.php b/src/Command/DeleteUnusedIndicesCommand.php new file mode 100644 index 00000000..92ca5c1e --- /dev/null +++ b/src/Command/DeleteUnusedIndicesCommand.php @@ -0,0 +1,28 @@ +elasticsearchManager->deleteUnusedIndices(); + + return Command::SUCCESS; + } +} diff --git a/src/Command/DevRobotsTxtCommand.php b/src/Command/DevRobotsTxtCommand.php index f6e58b7c..c8da01e0 100644 --- a/src/Command/DevRobotsTxtCommand.php +++ b/src/Command/DevRobotsTxtCommand.php @@ -50,6 +50,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int return self::SUCCESS; } + /** @phpstan-ignore shopware.forbidLocalDiskWrite */ $robotsFile = fopen($robotsPath, 'wb'); \assert($robotsFile !== false); @@ -72,6 +73,7 @@ private function revertToOriginal(InputInterface $input, OutputInterface $output // If only input from command is present if ($file === $createdString) { + /** @phpstan-ignore shopware.forbidLocalDiskWrite */ unlink($robotsPath); $io->success('robots.txt file deleted :)'); @@ -81,6 +83,7 @@ private function revertToOriginal(InputInterface $input, OutputInterface $output // removes everything between #soc & #eoc $content = preg_replace('/#soc[\s\S]+?#eoc/', '', $file); + /** @phpstan-ignore shopware.forbidLocalDiskWrite */ file_put_contents($robotsPath, $content); $io->success('robots.txt reverted to original :)'); @@ -103,6 +106,7 @@ private function changeRobotsTxt(InputInterface $input, OutputInterface $output, } $content = "#soc\nUser-agent: *\nDisallow: /\n#eoc\n" . $file; + /** @phpstan-ignore shopware.forbidLocalDiskWrite */ file_put_contents($robotsPath, $content); $io->success('robots.txt changed :)'); diff --git a/src/Command/ExtensionChecksumCreateCommand.php b/src/Command/ExtensionChecksumCreateCommand.php index 7fea02dd..dc3da268 100644 --- a/src/Command/ExtensionChecksumCreateCommand.php +++ b/src/Command/ExtensionChecksumCreateCommand.php @@ -80,6 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int return self::FAILURE; } + /** @phpstan-ignore shopware.forbidLocalDiskWrite */ if (file_put_contents($checksumFilePath, \json_encode($checksumStruct->jsonSerialize(), \JSON_THROW_ON_ERROR)) === false) { $io->error(\sprintf('Failed to write to file "%s"', $checksumFilePath)); diff --git a/src/Components/CacheHelper.php b/src/Components/CacheHelper.php index 120a71b2..fdf312d1 100644 --- a/src/Components/CacheHelper.php +++ b/src/Components/CacheHelper.php @@ -22,6 +22,7 @@ public static function removeDir(string $path): void { // If the given path is a file if (is_file($path)) { + /** @phpstan-ignore shopware.forbidLocalDiskWrite */ unlink($path); return; @@ -30,6 +31,7 @@ public static function removeDir(string $path): void if (self::rsyncAvailable()) { $blankDir = sys_get_temp_dir() . '/' . uniqid() . '/'; + /** @phpstan-ignore shopware.forbidLocalDiskWrite */ if (!mkdir($blankDir, 0o755, true) && !is_dir($blankDir)) { throw new \RuntimeException(\sprintf('Directory "%s" was not created', $blankDir)); } @@ -41,6 +43,7 @@ public static function removeDir(string $path): void throw new CannotClearCacheException($process->getErrorOutput()); } + /** @phpstan-ignore shopware.forbidLocalDiskWrite */ rmdir($blankDir); } else { $process = new Process(['find', $path . '/', '-delete']); diff --git a/src/Controller/ShopwareFilesController.php b/src/Controller/ShopwareFilesController.php index b8ae0a21..2c2c684f 100644 --- a/src/Controller/ShopwareFilesController.php +++ b/src/Controller/ShopwareFilesController.php @@ -164,6 +164,7 @@ public function restoreShopwareFile(Request $request, Context $context): JsonRes return new JsonResponse(['error' => 'File would be empty!']); } + /** @phpstan-ignore shopware.forbidLocalDiskWrite */ file_put_contents($path, $content); if (\function_exists('opcache_reset')) { diff --git a/src/Resources/app/administration/src/module/frosh-tools/page/index/index.js b/src/Resources/app/administration/src/module/frosh-tools/page/index/index.js index 7a63f66a..cba8fb63 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/page/index/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/page/index/index.js @@ -1,24 +1,23 @@ import './frosh-tools.scss'; import template from './template.twig'; -const {Component} = Shopware; +const { Component } = Shopware; Component.register('frosh-tools-index', { - template, - computed: { - elasticsearchAvailable() { - try { - return ( - Shopware.Store.get('context').app.config.settings - ?.elasticsearchEnabled || false - ); - - } catch { - return ( - Shopware.State.get('context').app.config.settings - ?.elasticsearchEnabled || false - ); - } + template, + computed: { + elasticsearchAvailable() { + try { + return ( + Shopware.Store.get('context').app.config.settings + ?.elasticsearchEnabled || false + ); + } catch { + return ( + Shopware.State.get('context').app.config.settings + ?.elasticsearchEnabled || false + ); + } + }, }, - }, });