Skip to content
Browse files

MDL-37935 cache: improved ready testing of stores on admin screen and…

… testing script
  • Loading branch information...
1 parent 19075a2 commit 704d82627c4b311f625850a6ecf4cd8aab65ff68 Sam Hemelryk committed Feb 18, 2013
Showing with 22 additions and 1 deletion.
  1. +11 −1 cache/renderer.php
  2. +7 −0 cache/testperformance.php
  3. +3 −0 lang/en/cache.php
  4. +1 −0 theme/base/style/admin.css
View
12 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),
View
7 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);
View
3 lang/en/cache.php
@@ -101,6 +101,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.';
View
1 theme/base/style/admin.css
@@ -287,5 +287,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; }

0 comments on commit 704d826

Please sign in to comment.
Something went wrong with that request. Please try again.