Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Disable Product Stream Indexer" checker #299

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

namespace Frosh\Tools\Components\Health\Checker\PerformanceChecker;

use Frosh\Tools\Components\Health\Checker\CheckerInterface;
use Frosh\Tools\Components\Health\HealthCollection;
use Frosh\Tools\Components\Health\SettingsResult;
use Symfony\Component\DependencyInjection\Attribute\Autowire;

class ProductStreamIndexingChecker implements PerformanceCheckerInterface, CheckerInterface
{
public function __construct(
#[Autowire(param: 'shopware.product_stream.indexing')]
private readonly bool $productStreamIndexingEnabled,
) {}

public function collect(HealthCollection $collection): void
{
if ($this->productStreamIndexingEnabled) {
$collection->add(
SettingsResult::info(
'product-stream-indexing',
'Product Stream Indexing',
'enabled',
'disabled',
'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#disable-product-stream-indexer',
),
);
}
}
}
36 changes: 14 additions & 22 deletions src/DependencyInjection/SymfonyConfigCompilerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,20 @@ public function process(ContainerBuilder $container): void
$container->setParameter('frosh_tools.queue_connection', 'unknown://default');
}

if (!$container->hasParameter('shopware.cache.cache_compression_method')) {
$container->setParameter('shopware.cache.cache_compression_method', false);
}

if (!$container->hasParameter('shopware.cart.compression_method')) {
$container->setParameter('shopware.cart.compression_method', false);
}

if (!$container->hasParameter('shopware.cache.tagging.each_config')) {
$container->setParameter('shopware.cache.tagging.each_config', true);
}

if (!$container->hasParameter('shopware.cache.tagging.each_snippet')) {
$container->setParameter('shopware.cache.tagging.each_snippet', true);
}

if (!$container->hasParameter('shopware.cache.tagging.each_theme_config')) {
$container->setParameter('shopware.cache.tagging.each_theme_config', true);
}

if (!$container->hasParameter('framework.secrets.enabled')) {
$container->setParameter('framework.secrets.enabled', true);
$defaultParameters = [
'framework.secrets.enabled' => true,
'shopware.cache.cache_compression_method' => false,
'shopware.cache.tagging.each_config' => true,
'shopware.cache.tagging.each_snippet' => true,
'shopware.cache.tagging.each_theme_config' => true,
'shopware.cart.compression_method' => false,
'shopware.product_stream.indexing' => false,
];

foreach ($defaultParameters as $parameter => $value) {
if (!$container->hasParameter($parameter)) {
$container->setParameter($parameter, $value);
}
}
}
}
Loading