MDL-48506 cachestore_memcached: make warning more noticeable

This commit is contained in:
Mark Nelson 2016-04-19 17:11:05 +08:00
parent f3eb9951d1
commit 027eb38ed5
2 changed files with 8 additions and 7 deletions

View File

@ -41,10 +41,18 @@ class cachestore_memcached_addinstance_form extends cachestore_addinstance_form
* Adds the desired form elements.
*/
protected function configuration_definition() {
global $OUTPUT;
$form = $this->_form;
$version = phpversion('memcached');
$hasrequiredversion = ($version || version_compare($version, cachestore_memcached::REQUIRED_VERSION, '>='));
if (!$hasrequiredversion) {
$notify = new \core\output\notification(nl2br(get_string('upgrade200recommended', 'cachestore_memcached')),
\core\output\notification::NOTIFY_WARNING);
$form->addElement('html', $OUTPUT->render($notify));
}
$form->addElement('textarea', 'servers', get_string('servers', 'cachestore_memcached'), array('cols' => 75, 'rows' => 5));
$form->addHelpButton('servers', 'servers', 'cachestore_memcached');
$form->addRule('servers', get_string('required'), 'required');
@ -97,12 +105,6 @@ class cachestore_memcached_addinstance_form extends cachestore_addinstance_form
$form->addHelpButton('setservers', 'setservers', 'cachestore_memcached');
$form->disabledIf('setservers', 'clustered');
$form->setType('setservers', PARAM_RAW);
if (!$hasrequiredversion) {
$form->addElement('header', 'upgradenotice', get_string('notice', 'cachestore_memcached'));
$form->setExpanded('upgradenotice');
$form->addElement('html', nl2br(get_string('upgrade200recommended', 'cachestore_memcached')));
}
}
/**

View File

@ -53,7 +53,6 @@ If the cache is shared by other applications then each key will be deleted indiv
If you are running a dedicated cache for this application then the entire cache can safely be flushed without any risk of destroying another application's cache data. This should result in increased performance when purging the cache.
";
$string['notice'] = 'Notice';
$string['pluginname'] = 'Memcached';
$string['prefix'] = 'Prefix key';
$string['prefix_help'] = 'This can be used to create a "domain" for your item keys allowing you to create multiple memcached stores on a single memcached installation. It cannot be longer than 16 characters in order to ensure key length issues are not encountered.';