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

This commit is contained in:
Sam Hemelryk 2013-02-18 11:36:01 +13:00
parent cce0d9a100
commit c643628f23
4 changed files with 22 additions and 1 deletions

12
cache/renderer.php vendored
View File

@ -93,15 +93,25 @@ class core_cache_renderer extends plugin_renderer_base {
$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 File

@ -55,6 +55,7 @@ $strinvalidplugin = new lang_string('invalidplugin', 'cache');
$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 @@ foreach (get_plugin_list_with_file('cachestore', 'lib.php', true) as $plugin =>
$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 @@ foreach (get_plugin_list_with_file('cachestore', 'lib.php', true) as $plugin =>
$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 @@ foreach (get_plugin_list_with_file('cachestore', 'lib.php', true) as $plugin =>
$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 File

@ -105,6 +105,9 @@ $string['storenamealreadyused'] = 'You must choose a unique name for this store.
$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 File

@ -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; }