|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
namespace ShopwareEnvironmentVariables\Source\Commands; |
|
4
|
|
|
|
|
5
|
|
|
use Doctrine\DBAL\Connection; |
|
|
|
|
|
|
6
|
|
|
use Shopware\Components\Plugin\ConfigReader; |
|
|
|
|
|
|
7
|
|
|
use Symfony\Component\Console\Command\Command; |
|
|
|
|
|
|
8
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
|
|
|
|
|
9
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
class ExportSettingsCommand extends Command |
|
12
|
|
|
{ |
|
13
|
|
|
/** |
|
14
|
|
|
* @var ConfigReader |
|
15
|
|
|
*/ |
|
16
|
|
|
private $configReader; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* @var Connection |
|
20
|
|
|
*/ |
|
21
|
|
|
private $connection; |
|
22
|
|
|
|
|
23
|
|
|
public function __construct(ConfigReader $configReader, Connection $connection) |
|
24
|
|
|
{ |
|
25
|
|
|
parent::__construct(); |
|
26
|
|
|
$this->configReader = $configReader; |
|
27
|
|
|
$this->connection = $connection; |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* {@inheritdoc} |
|
32
|
|
|
*/ |
|
33
|
|
|
protected function configure() |
|
34
|
|
|
{ |
|
35
|
|
|
$this->setName('shopware-blog:export:settings'); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* {@inheritdoc} |
|
40
|
|
|
*/ |
|
41
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
|
42
|
|
|
{ |
|
43
|
|
|
$plugins = $this->connection |
|
44
|
|
|
->fetchAll( |
|
45
|
|
|
'SELECT name FROM s_core_plugins |
|
46
|
|
|
WHERE name != \'PluginManager\' |
|
47
|
|
|
AND capability_enable = 1' |
|
48
|
|
|
); |
|
49
|
|
|
$shopIds = $this->connection |
|
50
|
|
|
->fetchAll('SELECT id FROM s_core_shops'); |
|
51
|
|
|
|
|
52
|
|
|
$config = []; |
|
53
|
|
|
foreach ($plugins as $plugin) { |
|
54
|
|
|
foreach ($shopIds as $shopId) { |
|
55
|
|
|
$pluginConfig = $this->configReader->getByPluginName($plugin['name']); |
|
56
|
|
|
if ($pluginConfig) { |
|
57
|
|
|
$config['plugins'][(int) $shopId['id']][$plugin['name']] = $pluginConfig; |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
file_put_contents( |
|
63
|
|
|
__DIR__ . '/../../plugins_config.php', |
|
64
|
|
|
'<?php' . "\n\n" . var_export($config, true) . ';', |
|
65
|
|
|
LOCK_EX |
|
66
|
|
|
); |
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
|
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