Permalink
Browse files

MDL-45388 admin: warn of themedesignermode in /admin/ and perf footer

This is:
a) To help avoid devs going on a wild goose chase to find a perf issue
when it's caused by css building
b) To make it clearer that this should never be enabled on production
sites (we already have a warning in the performance report, but who
looks at that)

Now that boost is the default theme and builds css itself, it's more
critical.
  • Loading branch information...
danpoltawski committed Oct 6, 2016
1 parent ddd8dc0 commit 586cf92909cbc1deb9216cdd53598a5401661572
Showing with 23 additions and 2 deletions.
  1. +2 −1 admin/index.php
  2. +15 −1 admin/renderer.php
  3. +1 −0 lang/en/admin.php
  4. +5 −0 lib/moodlelib.php
View
@@ -851,11 +851,12 @@
$cachewarnings = cache_helper::warnings();
// Check if there are events 1 API handlers.
$eventshandlers = $DB->get_records_sql('SELECT DISTINCT component FROM {events_handlers}');
$themedesignermode = !empty($CFG->themedesignermode);
admin_externalpage_setup('adminnotifications');
$output = $PAGE->get_renderer('core', 'admin');
echo $output->admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed, $cronoverdue, $dbproblems,
$maintenancemode, $availableupdates, $availableupdatesfetch, $buggyiconvnomb,
$registered, $cachewarnings, $eventshandlers);
$registered, $cachewarnings, $eventshandlers, $themedesignermode);
View
@@ -281,7 +281,7 @@ public function upgrade_confirm_abort_install_page(array $abortable, moodle_url
*/
public function admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed,
$cronoverdue, $dbproblems, $maintenancemode, $availableupdates, $availableupdatesfetch,
$buggyiconvnomb, $registered, array $cachewarnings = array(), $eventshandlers = 0) {
$buggyiconvnomb, $registered, array $cachewarnings = array(), $eventshandlers = 0, $themedesignermode = false) {
global $CFG;
$output = '';
@@ -290,6 +290,7 @@ public function admin_notifications_page($maturity, $insecuredataroot, $errorsdi
$output .= $this->legacy_log_store_writing_error();
$output .= empty($CFG->disableupdatenotifications) ? $this->available_updates($availableupdates, $availableupdatesfetch) : '';
$output .= $this->insecure_dataroot_warning($insecuredataroot);
$output .= $this->themedesignermode_warning($themedesignermode);
$output .= $this->display_errors_warning($errorsdisplayed);
$output .= $this->buggy_iconv_warning($buggyiconvnomb);
$output .= $this->cron_overdue_warning($cronoverdue);
@@ -532,6 +533,19 @@ protected function display_errors_warning($errorsdisplayed) {
return $this->warning(get_string('displayerrorswarning', 'admin'));
}
/**
* Render an appropriate message if themdesignermode is enabled.
* @param bool $themedesignermode true if enabled
* @return string HTML to output.
*/
protected function themedesignermode_warning($themedesignermode) {
if (!$themedesignermode) {
return '';
}
return $this->warning(get_string('themedesignermodewarning', 'admin'));
}
/**
* Render an appropriate message if iconv is buggy and mbstring missing.
* @param bool $buggyiconvnomb
View
@@ -1065,6 +1065,7 @@
$string['tasktempfilecleanup'] = 'Delete stale temp files';
$string['tempdatafoldercleanup'] = 'Clean up temporary data files older than';
$string['themedesignermode'] = 'Theme designer mode';
$string['themedesignermodewarning'] = 'Theme designer mode is enabled. This should not be enabled on production sites as it can significantly reduce performance.';
$string['themelist'] = 'Theme list';
$string['themenoselected'] = 'No theme selected';
$string['themeresetcaches'] = 'Clear theme caches';
View
@@ -8955,6 +8955,11 @@ function get_performance_info() {
$info['html'] = ''; // Holds userfriendly HTML representation.
$info['txt'] = me() . ' '; // Holds log-friendly representation.
if (!empty($CFG->themedesignermode)) {
// Attempt to avoid devs debugging peformance issues, when its caused by css building and so on.
$info['html'] = '<p><strong>Warning: Theme designer mode is enabled.</strong></p>';
}
$info['realtime'] = microtime_diff($PERF->starttime, microtime());
$info['html'] .= '<span class="timeused">'.$info['realtime'].' secs</span> ';

0 comments on commit 586cf92

Please sign in to comment.