@@ -1341,11 +1341,21 @@ function drush_core_execute() {
1341
1341
function drush_core_twig_compile () {
1342
1342
require_once DRUSH_DRUPAL_CORE . "/themes/engines/twig/twig.engine " ;
1343
1343
// Scan all enabled modules and themes.
1344
- // @todo Refactor to not reuse commandfile paths directly.
1345
- $ boot = \Drush::bootstrap ();
1346
- $ searchpaths = $ boot ->commandfile_searchpaths (DRUSH_BOOTSTRAP_DRUPAL_FULL );
1347
- $ searchpaths [] = drupal_get_path ('theme ' , drush_theme_get_default ());;
1348
- $ searchpaths [] = drupal_get_path ('theme ' , drush_theme_get_admin ());
1344
+ // @todo refactor since \Drush\Boot\DrupalBoot::commandfile_searchpaths is similar.
1345
+ $ ignored_modules = drush_get_option_list ('ignored-modules ' , array ());
1346
+ $ cid = drush_cid_install_profile ();
1347
+ if ($ cached = drush_cache_get ($ cid )) {
1348
+ $ ignored_modules [] = $ cached ->data ;
1349
+ }
1350
+ foreach (array_diff (drush_module_list (), $ ignored_modules ) as $ module ) {
1351
+ $ searchpaths [] = drupal_get_path ('module ' , $ module );
1352
+ }
1353
+
1354
+ $ themes = drush_theme_list ();
1355
+ foreach ($ themes as $ name => $ theme ) {
1356
+ $ searchpaths [] = $ theme ->getPath ();
1357
+ }
1358
+
1349
1359
foreach ($ searchpaths as $ searchpath ) {
1350
1360
foreach ($ file = drush_scan_directory ($ searchpath , '/\.html.twig/ ' , array ('tests ' )) as $ file ) {
1351
1361
$ relative = str_replace (drush_get_context ('DRUSH_DRUPAL_ROOT ' ). '/ ' , '' , $ file ->filename );
0 commit comments