File tree Expand file tree Collapse file tree 2 files changed +29
-6
lines changed Expand file tree Collapse file tree 2 files changed +29
-6
lines changed Original file line number Diff line number Diff line change 9
9
use Magento \Backend \Setup \ConfigOptionsList as BackendConfigOptionsList ;
10
10
use Magento \Framework \App \Cache \Manager ;
11
11
use Magento \Framework \App \Cache \Type \Block as BlockCache ;
12
+ use Magento \Framework \App \Cache \Type \Config as ConfigCache ;
12
13
use Magento \Framework \App \Cache \Type \Layout as LayoutCache ;
13
14
use Magento \Framework \App \DeploymentConfig \Reader ;
14
15
use Magento \Framework \App \DeploymentConfig \Writer ;
@@ -1291,6 +1292,7 @@ public function updateModulesSequence($keepGeneratedFiles = false)
1291
1292
. " Run 'magento setup:config:set --help' for options. "
1292
1293
);
1293
1294
}
1295
+ $ this ->flushCaches ([ConfigCache::TYPE_IDENTIFIER ]);
1294
1296
$ this ->cleanCaches ();
1295
1297
if (!$ keepGeneratedFiles ) {
1296
1298
$ this ->cleanupGeneratedFiles ();
@@ -1397,6 +1399,25 @@ private function cleanCaches()
1397
1399
$ this ->log ->log ('Cache cleared successfully ' );
1398
1400
}
1399
1401
1402
+ /**
1403
+ * Flush caches for specific types or all available types
1404
+ *
1405
+ * @param array $types
1406
+ * @return void
1407
+ *
1408
+ * @throws Exception
1409
+ */
1410
+ private function flushCaches ($ types = [])
1411
+ {
1412
+ /** @var Manager $cacheManager */
1413
+ $ cacheManager = $ this ->objectManagerProvider ->get ()->get (Manager::class);
1414
+ if (empty ($ types )) {
1415
+ $ types = $ cacheManager ->getAvailableTypes ();
1416
+ }
1417
+ $ cacheManager ->flush ($ types );
1418
+ $ this ->log ->log ('Cache types ' . implode (', ' , $ types ) . ' flushed successfully ' );
1419
+ }
1420
+
1400
1421
/**
1401
1422
* Enables or disables maintenance mode for Magento application
1402
1423
*
Original file line number Diff line number Diff line change @@ -588,11 +588,12 @@ public function testUpdateModulesSequence()
588
588
);
589
589
$ installer = $ this ->prepareForUpdateModulesTests ();
590
590
591
- $ this ->logger ->expects ($ this ->at (0 ))->method ('log ' )->with ('Cache cleared successfully ' );
592
- $ this ->logger ->expects ($ this ->at (1 ))->method ('log ' )->with ('File system cleanup: ' );
593
- $ this ->logger ->expects ($ this ->at (2 ))->method ('log ' )
591
+ $ this ->logger ->expects ($ this ->at (0 ))->method ('log ' )->with ('Cache types config flushed successfully ' );
592
+ $ this ->logger ->expects ($ this ->at (1 ))->method ('log ' )->with ('Cache cleared successfully ' );
593
+ $ this ->logger ->expects ($ this ->at (2 ))->method ('log ' )->with ('File system cleanup: ' );
594
+ $ this ->logger ->expects ($ this ->at (3 ))->method ('log ' )
594
595
->with ('The directory \'/generation \' doesn \'t exist - skipping cleanup ' );
595
- $ this ->logger ->expects ($ this ->at (3 ))->method ('log ' )->with ('Updating modules: ' );
596
+ $ this ->logger ->expects ($ this ->at (4 ))->method ('log ' )->with ('Updating modules: ' );
596
597
$ installer ->updateModulesSequence (false );
597
598
}
598
599
@@ -602,8 +603,9 @@ public function testUpdateModulesSequenceKeepGenerated()
602
603
603
604
$ installer = $ this ->prepareForUpdateModulesTests ();
604
605
605
- $ this ->logger ->expects ($ this ->at (0 ))->method ('log ' )->with ('Cache cleared successfully ' );
606
- $ this ->logger ->expects ($ this ->at (1 ))->method ('log ' )->with ('Updating modules: ' );
606
+ $ this ->logger ->expects ($ this ->at (0 ))->method ('log ' )->with ('Cache types config flushed successfully ' );
607
+ $ this ->logger ->expects ($ this ->at (1 ))->method ('log ' )->with ('Cache cleared successfully ' );
608
+ $ this ->logger ->expects ($ this ->at (2 ))->method ('log ' )->with ('Updating modules: ' );
607
609
$ installer ->updateModulesSequence (true );
608
610
}
609
611
You can’t perform that action at this time.
0 commit comments