File tree Expand file tree Collapse file tree 2 files changed +41
-12
lines changed Expand file tree Collapse file tree 2 files changed +41
-12
lines changed Original file line number Diff line number Diff line change @@ -12,19 +12,16 @@ 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+ if ($ event ->getType () === ConfigurationBuilder::MODEL_ALIAS ) {
16+ $ this ->clearCache ();
2617 }
2718 }
19+
20+ public function onCacheFlush ()
21+ {
22+ $ this ->clearCache ();
23+ }
24+
2825 public function onPreDispatch (Varien_Event_Observer $ event )
2926 {
3027 $ controller = $ event ->getControllerAction ();
@@ -34,6 +31,20 @@ public function onPreDispatch(Varien_Event_Observer $event)
3431 ])->setupDependencies ($ controller );
3532 }
3633
34+ private function clearCache ()
35+ {
36+ $ containerFilePath = $ this ->containerCachePath ();
37+ $ metaFilePath = $ this ->containerCacheMetaPath ();
38+
39+ if (file_exists ($ containerFilePath )) {
40+ unlink ($ containerFilePath );
41+ }
42+
43+ if (file_exists ($ metaFilePath )) {
44+ unlink ($ metaFilePath );
45+ }
46+ }
47+
3748 private function containerCachePath ()
3849 {
3950 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 >onCacheFlush</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 >onCacheFlush</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