From c643628f23a05008101e826d5ea9e637871d879e Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Mon, 18 Feb 2013 11:36:01 +1300 Subject: [PATCH] MDL-37935 cache: improved ready testing of stores on admin screen and testing script --- cache/renderer.php | 12 +++++++++++- cache/testperformance.php | 7 +++++++ lang/en/cache.php | 3 +++ theme/base/style/admin.css | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/cache/renderer.php b/cache/renderer.php index 7e55df8bf04fe..dae5479a766d2 100644 --- a/cache/renderer.php +++ b/cache/renderer.php @@ -93,15 +93,25 @@ public function store_instance_summariers(array $stores, array $plugins) { $htmlactions[] = $this->output->action_link($action['url'], $action['text']); } + $isready = $store['isready'] && $store['requirementsmet']; + $readycell = new html_table_cell; + if ($isready) { + $readycell->text = $this->output->pix_icon('i/valid', '1'); + } + $storename = $store['name']; if (!empty($store['default'])) { $storename = get_string('store_'.$store['name'], 'cache'); } + if (!$isready && (int)$store['mappings'] > 0) { + $readycell->text = $this->output->help_icon('storerequiresattention', 'cache'); + $readycell->attributes['class'] = 'store-requires-attention'; + } $row = new html_table_row(array( $storename, get_string('pluginname', 'cachestore_'.$store['plugin']), - ($store['isready'] && $store['requirementsmet']) ? $this->output->pix_icon('i/valid', '1') : '', + $readycell, $store['mappings'], join(', ', $modes), join(', ', $supports), diff --git a/cache/testperformance.php b/cache/testperformance.php index a4704dc25c85b..301bee19d4f31 100644 --- a/cache/testperformance.php +++ b/cache/testperformance.php @@ -55,6 +55,7 @@ $strunsupportedmode = new lang_string('unsupportedmode', 'cache'); $struntestable = new lang_string('untestable', 'cache'); $strtested = new lang_string('tested', 'cache'); +$strnotready = new lang_string('storenotready', 'cache'); foreach (get_plugin_list_with_file('cachestore', 'lib.php', true) as $plugin => $path) { @@ -74,6 +75,8 @@ $store = $class::initialise_test_instance($application); if ($store === false) { $applicationtable->data[] = array($plugin, $struntestable, '-', '-', '-', '-'); + } else if (!$store->is_ready()) { + $applicationtable->data[] = array($plugin, $strnotready, '-', '-', '-', '-'); } else { $result = array($plugin, $strtested, 0, 0, 0); $start = microtime(true); @@ -110,6 +113,8 @@ $store = $class::initialise_test_instance($session); if ($store === false) { $sessiontable->data[] = array($plugin, $struntestable, '-', '-', '-', '-'); + } else if (!$store->is_ready()) { + $sessiontable->data[] = array($plugin, $strnotready, '-', '-', '-', '-'); } else { $result = array($plugin, $strtested, 0, 0, 0); $start = microtime(true); @@ -146,6 +151,8 @@ $store = $class::initialise_test_instance($request); if ($store === false) { $requesttable->data[] = array($plugin, $struntestable, '-', '-', '-', '-'); + } else if (!$store->is_ready()) { + $requesttable->data[] = array($plugin, $strnotready, '-', '-', '-', '-'); } else { $result = array($plugin, $strtested, 0, 0, 0); $start = microtime(true); diff --git a/lang/en/cache.php b/lang/en/cache.php index 64d772be57c1c..687c0cdbf62d1 100644 --- a/lang/en/cache.php +++ b/lang/en/cache.php @@ -105,6 +105,9 @@ $string['storenameinvalid'] = 'Invalid store name. You can only use a-z A-Z 0-9 -_ and spaces.'; $string['storeperformance'] = 'Cache store performance reporting - {$a} unique requests per operation.'; $string['storeready'] = 'Ready'; +$string['storenotready'] = 'Store not ready'; +$string['storerequiresattention'] = 'Requries attention.'; +$string['storerequiresattention_help'] = 'This store instance is not ready to be used but has mappings. Fixing this issue will improve performance on your system. Please check that the store backend is ready to be used and that any PHP requirements are met.'; $string['storeresults_application'] = 'Store requests when used as an application cache.'; $string['storeresults_request'] = 'Store requests when used as a request cache.'; $string['storeresults_session'] = 'Store requests when used as a session cache.'; diff --git a/theme/base/style/admin.css b/theme/base/style/admin.css index 43ea38b5fd313..e98ce044cc2da 100644 --- a/theme/base/style/admin.css +++ b/theme/base/style/admin.css @@ -333,5 +333,6 @@ #core-cache-store-summaries .default-store td {color:#333;font-style: italic;} #core-cache-rescan-definitions, #core-cache-mode-mappings .edit-link {margin-top:0.5em;text-align:center;} +#core-cache-store-summaries .store-requires-attention {background-color:#ffd3d9;} .tinymcesubplugins img.icon { padding-top: 0; padding-bottom: 0; }