diff --git a/admin/tool/behat/cli/util_single_run.php b/admin/tool/behat/cli/util_single_run.php index 42b335cc8cb..868dd84b3e5 100644 --- a/admin/tool/behat/cli/util_single_run.php +++ b/admin/tool/behat/cli/util_single_run.php @@ -187,10 +187,13 @@ if ($options['install']) { behat_config_manager::set_behat_run_config_value('axe', $options['axe']); // Enable test mode. + $timestart = microtime(true); + mtrace('Creating Behat configuration ...', ''); behat_util::start_test_mode($options['add-core-features-to-theme'], $options['optimize-runs'], $parallel, $run); + mtrace(' done in ' . round(microtime(true) - $timestart, 2) . ' seconds.'); // Themes are only built in the 'enable' command. - behat_util::build_themes(); + behat_util::build_themes(true); mtrace("Testing environment themes built"); // This is only displayed once for parallel install. diff --git a/lib/behat/classes/util.php b/lib/behat/classes/util.php index aff5dcf6322..feaf4e67280 100644 --- a/lib/behat/classes/util.php +++ b/lib/behat/classes/util.php @@ -135,7 +135,7 @@ class behat_util extends testing_util { /** * Build theme CSS. */ - public static function build_themes() { + public static function build_themes($mtraceprogress = false) { global $CFG; require_once("{$CFG->libdir}/outputlib.php"); @@ -147,7 +147,7 @@ class behat_util extends testing_util { }, $themenames); // Build the list of themes and cache them in local cache. - $themes = theme_build_css_for_themes($themeconfigs, ['ltr'], true); + $themes = theme_build_css_for_themes($themeconfigs, ['ltr'], true, $mtraceprogress); $framework = self::get_framework(); $storageroot = self::get_dataroot() . "/{$framework}/themedata"; @@ -278,7 +278,6 @@ class behat_util extends testing_util { * @return void */ public static function start_test_mode($themesuitewithallfeatures = false, $tags = '', $parallelruns = 0, $run = 0) { - global $CFG; if (!defined('BEHAT_UTIL')) { throw new coding_exception('This method can be only used by Behat CLI tool'); diff --git a/lib/outputlib.php b/lib/outputlib.php index 6b22cfcf07c..9f533ca84d4 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -181,7 +181,8 @@ function theme_get_css_filename($themename, $globalrevision, $themerevision, $di * @param bool $cache Should the generated files be stored in local cache. * @return array The built theme content in a multi-dimensional array of name => direction => content */ -function theme_build_css_for_themes($themeconfigs = [], $directions = ['rtl', 'ltr'], $cache = true): array { +function theme_build_css_for_themes($themeconfigs = [], $directions = ['rtl', 'ltr'], + $cache = true, $mtraceprogress = false): array { global $CFG; if (empty($themeconfigs)) { @@ -202,6 +203,11 @@ function theme_build_css_for_themes($themeconfigs = [], $directions = ['rtl', 'l // First generate all the new css. foreach ($directions as $direction) { + if ($mtraceprogress) { + $timestart = microtime(true); + mtrace('Building theme CSS for ' . $themeconfig->name . ' [' . + $direction . '] ...', ''); + } // Lock it on. Technically we should build all themes for SVG and no SVG - but ie9 is out of support. $themeconfig->force_svg_use(true); $themeconfig->set_rtl_mode(($direction === 'rtl')); @@ -212,6 +218,9 @@ function theme_build_css_for_themes($themeconfigs = [], $directions = ['rtl', 'l $filename = theme_get_css_filename($themeconfig->name, $themerev, $newrevision, $direction); css_store_css($themeconfig, $filename, $themecss[$direction]); } + if ($mtraceprogress) { + mtrace(' done in ' . round(microtime(true) - $timestart, 2) . ' seconds.'); + } } $themescss[$themeconfig->name] = $themecss;