Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-40700 cache: Validate memcache key prefix field

  • Loading branch information...
commit a423acd95c3b51197fd95f7feaa5b77264712a65 1 parent ffc3f53
@PeloNZ PeloNZ authored samhemelryk committed
Showing with 3 additions and 1 deletion.
  1. +2 −1  cache/stores/memcache/addinstanceform.php
  2. +1 −0  lang/en/cache.php
View
3  cache/stores/memcache/addinstanceform.php
@@ -49,7 +49,8 @@ protected function configuration_definition() {
$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
1  lang/en/cache.php
@@ -141,6 +141,7 @@
$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.';
Please sign in to comment.
Something went wrong with that request. Please try again.