File tree Expand file tree Collapse file tree
Components/Health/Checker/PerformanceChecker
app/administration/src/module/frosh-tools/snippet Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ namespace Frosh \Tools \Components \Health \Checker \PerformanceChecker ;
4+
5+ use Frosh \Tools \Components \Health \Checker \CheckerInterface ;
6+ use Frosh \Tools \Components \Health \HealthCollection ;
7+ use Frosh \Tools \Components \Health \SettingsResult ;
8+ use Shopware \Core \DevOps \Environment \EnvironmentHelper ;
9+ use function sprintf ;
10+ use function version_compare ;
11+
12+ class FixCacheSetChecker implements CheckerInterface
13+ {
14+ protected string $ shopwareVersion ;
15+
16+ public function __construct (string $ shopwareVersion )
17+ {
18+ $ this ->shopwareVersion = $ shopwareVersion ;
19+ }
20+
21+ public function collect (HealthCollection $ collection ): void
22+ {
23+ if (version_compare ('6.4.11.0 ' , $ this ->shopwareVersion , '> ' )) {
24+ return ;
25+ }
26+
27+ $ cacheId = (string ) EnvironmentHelper::getVariable ('SHOPWARE_CACHE_ID ' , '' );
28+
29+ if ($ cacheId === '' ) {
30+ $ collection ->add (
31+ SettingsResult::warning ('frosh-tools.checker.fixCacheIdNotSet ' ,
32+ 'not set ' ,
33+ 'set ' ,
34+ 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks#cache-id '
35+ )
36+ );
37+
38+ return ;
39+ }
40+
41+ $ collection ->add (
42+ SettingsResult::ok ('frosh-tools.checker.fixCacheIdIsSet ' ,
43+ sprintf ('set (%s) ' , $ cacheId ),
44+ 'set ' ,
45+ )
46+ );
47+ }
48+ }
Original file line number Diff line number Diff line change 101101 "incrementStorageIsDB" : " Increment storage sollte im optimal fall Redis verwenden oder deaktiviert sein" ,
102102 "incrementStorageIsNotDB" : " Increment storage ist richtig konfiguriert" ,
103103 "queueIsDefault" : " Die Message Queue in der Datenbank skaliert nicht gut mit mehreren Workern" ,
104- "queueIsOk" : " Die Message Queue ist richtig konfiguriert"
104+ "queueIsOk" : " Die Message Queue ist richtig konfiguriert" ,
105+ "fixCacheIdNotSet" : " Eine feste Cache-ID sollte konfiguriert sein, um diese nicht immer aus der Datenbank zu lesen" ,
106+ "fixCacheIdIsSet" : " Eine feste Cache-ID ist konfiguriert"
105107 },
106108 "size" : " Größe" ,
107109 "docs" : " Dokumente" ,
Original file line number Diff line number Diff line change 101101 "incrementStorageIsDB" : " Increment storage is heavily using the Storage. This feature should be disabled or Redis should be used" ,
102102 "incrementStorageIsNotDB" : " Increment storage is correct configured" ,
103103 "queueIsDefault" : " The default queue storage in database does not scale well with multiple workers" ,
104- "queueIsOk" : " Configured queue storage is ok for multiple workers"
104+ "queueIsOk" : " Configured queue storage is ok for multiple workers" ,
105+ "fixCacheIdNotSet" : " A fixed cache id should be set, so Shopware isn't loading it from Database on any request" ,
106+ "fixCacheIdIsSet" : " A fixed cache id is set"
105107 },
106108 "size" : " Size" ,
107109 "docs" : " Documents" ,
Original file line number Diff line number Diff line change 140140 <tag name =" frosh_tools.performance_checker" />
141141 </service >
142142
143+ <service id =" Frosh\Tools\Components\Health\Checker\PerformanceChecker\FixCacheSetChecker" >
144+ <argument >%kernel.shopware_version%</argument >
145+ <tag name =" frosh_tools.performance_checker" />
146+ </service >
147+
143148 <service id =" Frosh\Tools\Components\Messenger\TaskLoggingMiddleware" >
144149 <argument type =" service" id =" frosh_tools.logging.tasks" />
145150 </service >
You can’t perform that action at this time.
0 commit comments