MDL-40700 cache: Validate memcache key prefix field

This commit is contained in:
Chris Wharton 2013-07-18 13:44:26 +12:00 committed by Sam Hemelryk
parent ffc3f5308b
commit a423acd95c
2 changed files with 3 additions and 1 deletions

View File

@ -49,7 +49,8 @@ class cachestore_memcache_addinstance_form extends cachestore_addinstance_form {
$form->addElement('text', 'prefix', get_string('prefix', 'cachestore_memcache'),
array('maxlength' => 5, 'size' => 5));
$form->addHelpButton('prefix', 'prefix', 'cachestore_memcache');
$form->setType('prefix', PARAM_ALPHAEXT);
$form->addRule('prefix', get_string('storeprefixinvalid', 'cache'), 'regex', '#^[a-zA-Z0-9\-_ ]+$#');
$form->setType('prefix', PARAM_TEXT);
$form->setDefault('prefix', 'mdl_');
}
}

View File

@ -141,6 +141,7 @@ $string['storename_help'] = 'This sets the store name. It is used to identify th
$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['storeprefixinvalid'] = 'Invalid store prefix. You can only use a-z A-Z 0-9 -_ and spaces.';
$string['storeready'] = 'Ready';
$string['storenotready'] = 'Store not ready';
$string['storerequiresattention'] = 'Requires attention.';