Skip to content

Commit

Permalink
MDL-37935 cache: improved ready testing of stores on admin screen and…
Browse files Browse the repository at this point in the history
… testing script
  • Loading branch information
Sam Hemelryk committed Feb 28, 2013
1 parent cce0d9a commit c643628
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cache/renderer.php
Expand Up @@ -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),
Expand Down
7 changes: 7 additions & 0 deletions cache/testperformance.php
Expand Up @@ -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) {

Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions lang/en/cache.php
Expand Up @@ -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.';
Expand Down
1 change: 1 addition & 0 deletions theme/base/style/admin.css
Expand Up @@ -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; }

0 comments on commit c643628

Please sign in to comment.