1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace Shopware\Administration\Command; |
4
|
|
|
|
5
|
|
|
use Shopware\Core\Framework\Bundle; |
6
|
|
|
use Shopware\Core\Framework\Log\Package; |
7
|
|
|
use Symfony\Component\Console\Attribute\AsCommand; |
8
|
|
|
use Symfony\Component\Console\Command\Command; |
|
|
|
|
9
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
10
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
11
|
|
|
use Symfony\Component\Console\Style\SymfonyStyle; |
12
|
|
|
use Symfony\Component\Filesystem\Filesystem; |
13
|
|
|
use Symfony\Component\HttpKernel\KernelInterface; |
14
|
|
|
|
15
|
|
|
#[AsCommand( |
16
|
|
|
name: 'administration:delete-extension-local-public-files', |
17
|
|
|
description: 'Deletes all files in the local public folder of the extension. This command should run after assets:install so the assets are available in the public folder.', |
18
|
|
|
)] |
19
|
|
|
#[Package('admin')] |
20
|
|
|
class DeleteExtensionLocalPublicFilesCommand extends Command |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* @internal |
24
|
|
|
*/ |
25
|
|
|
public function __construct(private readonly KernelInterface $kernel) |
26
|
|
|
{ |
27
|
|
|
parent::__construct(); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
protected function execute(InputInterface $input, OutputInterface $output): int |
31
|
|
|
{ |
32
|
|
|
$fs = new Filesystem(); |
33
|
|
|
$io = new SymfonyStyle($input, $output); |
34
|
|
|
|
35
|
|
|
foreach ($this->kernel->getBundles() as $bundle) { |
36
|
|
|
if (!$bundle instanceof Bundle) { |
37
|
|
|
continue; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
$bundlePath = $bundle->getPath(); |
41
|
|
|
$publicPath = $bundlePath . '/Resources/public'; |
42
|
|
|
|
43
|
|
|
if (!is_dir($publicPath)) { |
44
|
|
|
continue; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
if (file_exists($bundlePath . '/Resources/public/administration/css')) { |
48
|
|
|
touch($bundle->getPath() . '/Resources/.administration-css'); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
if (file_exists($bundlePath . '/Resources/public/administration/js')) { |
52
|
|
|
touch($bundle->getPath() . '/Resources/.administration-js'); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
$fs->remove($publicPath); |
56
|
|
|
|
57
|
|
|
$io->success(sprintf('Removed public assets for bundle "%s"', $bundle->getName())); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
return self::SUCCESS; |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths