File tree Expand file tree Collapse file tree 2 files changed +37
-12
lines changed Expand file tree Collapse file tree 2 files changed +37
-12
lines changed Original file line number Diff line number Diff line change @@ -12,19 +12,12 @@ class Inviqa_SymfonyContainer_Model_Observer
1212
1313 public function onCacheRefresh (Varien_Event_Observer $ event )
1414 {
15- if (ConfigurationBuilder::MODEL_ALIAS === $ event ->getType ()) {
16- $ containerFilePath = $ this ->containerCachePath ();
17- $ metaFilePath = $ this ->containerCacheMetaPath ();
18-
19- if (file_exists ($ containerFilePath )) {
20- unlink ($ containerFilePath );
21- }
22-
23- if (file_exists ($ metaFilePath )) {
24- unlink ($ metaFilePath );
25- }
15+ $ eventType = $ event ->getType ();
16+ if ($ eventType === ConfigurationBuilder::MODEL_ALIAS || is_null ($ eventType )) {
17+ $ this ->clearCache ();
2618 }
2719 }
20+
2821 public function onPreDispatch (Varien_Event_Observer $ event )
2922 {
3023 $ controller = $ event ->getControllerAction ();
@@ -34,6 +27,20 @@ public function onPreDispatch(Varien_Event_Observer $event)
3427 ])->setupDependencies ($ controller );
3528 }
3629
30+ private function clearCache ()
31+ {
32+ $ containerFilePath = $ this ->containerCachePath ();
33+ $ metaFilePath = $ this ->containerCacheMetaPath ();
34+
35+ if (file_exists ($ containerFilePath )) {
36+ unlink ($ containerFilePath );
37+ }
38+
39+ if (file_exists ($ metaFilePath )) {
40+ unlink ($ metaFilePath );
41+ }
42+ }
43+
3744 private function containerCachePath ()
3845 {
3946 return Mage::getBaseDir ('cache ' ) . DIRECTORY_SEPARATOR . ConfigurationBuilder::CACHED_CONTAINER ;
Original file line number Diff line number Diff line change 2222 </inviqa_symfonyContainer >
2323 </observers >
2424 </adminhtml_cache_refresh_type >
25+ <adminhtml_cache_flush_all >
26+ <observers >
27+ <inviqa_symfonyContainer >
28+ <class >Inviqa_SymfonyContainer_Model_Observer</class >
29+ <type >singleton</type >
30+ <method >onCacheRefresh</method >
31+ </inviqa_symfonyContainer >
32+ </observers >
33+ </adminhtml_cache_flush_all >
34+ <adminhtml_cache_flush_system >
35+ <observers >
36+ <inviqa_symfonyContainer >
37+ <class >Inviqa_SymfonyContainer_Model_Observer</class >
38+ <type >singleton</type >
39+ <method >onCacheRefresh</method >
40+ </inviqa_symfonyContainer >
41+ </observers >
42+ </adminhtml_cache_flush_system >
2543 <controller_action_predispatch >
2644 <observers >
2745 <inviqa_symfonyContainer >
4361 </cache >
4462 </global >
4563
46- </config >
64+ </config >
You can’t perform that action at this time.
0 commit comments