MDL-36115 cache: Fixed up requirements check in cache admin interfaces
This commit is contained in:
Vendored
+3
@@ -54,6 +54,9 @@ if (!empty($action) && confirm_sesskey()) {
|
||||
break;
|
||||
case 'addstore' : // Add the requested store.
|
||||
$plugin = required_param('plugin', PARAM_PLUGIN);
|
||||
if (!$plugins[$plugin]['canaddinstance']) {
|
||||
print_error('ex_unmetstorerequirements', 'cache');
|
||||
}
|
||||
$mform = cache_administration_helper::get_add_store_form($plugin);
|
||||
$title = get_string('addstore', 'cache', $plugins[$plugin]['name']);
|
||||
if ($mform->is_cancelled()) {
|
||||
|
||||
Vendored
+2
-2
@@ -566,7 +566,7 @@ abstract class cache_administration_helper extends cache_helper {
|
||||
'nativelocking' => (in_array('cache_is_lockable', class_implements($class))),
|
||||
'keyawareness' => (array_key_exists('cache_is_key_aware', class_implements($class))),
|
||||
),
|
||||
'canaddinstance' => ($class::can_add_instance())
|
||||
'canaddinstance' => ($class::can_add_instance() && $class::are_requirements_met())
|
||||
);
|
||||
}
|
||||
|
||||
@@ -702,7 +702,7 @@ abstract class cache_administration_helper extends cache_helper {
|
||||
*/
|
||||
public static function get_store_plugin_actions($name, array $plugindetails) {
|
||||
$actions = array();
|
||||
if (has_capability('moodle/site:config', get_system_context())) {
|
||||
if (has_capability('moodle/site:config', context_system::instance())) {
|
||||
if (!empty($plugindetails['canaddinstance'])) {
|
||||
$url = new moodle_url('/cache/admin.php', array('action' => 'addstore', 'plugin' => $name, 'sesskey' => sesskey()));
|
||||
$actions[] = array(
|
||||
|
||||
@@ -63,6 +63,7 @@ $string['editdefinitionmappings'] = '{$a} definition store mappings';
|
||||
$string['ex_configcannotsave'] = 'Unable to save the cache config to file.';
|
||||
$string['ex_nodefaultlock'] = 'Unable to find a default lock instance.';
|
||||
$string['ex_unabletolock'] = 'Unable to acquire a lock for caching.';
|
||||
$string['ex_unmetstorerequirements'] = 'You are unable to use this store at the present time. Please refer to the documentation to determine its requirements.';
|
||||
$string['gethit'] = 'Get - Hit';
|
||||
$string['getmiss'] = 'Get - Miss';
|
||||
$string['invalidplugin'] = 'Invalid plugin';
|
||||
|
||||
Reference in New Issue
Block a user