forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'MDL-48468' of https://github.com/mr-russ/moodle
- Loading branch information
Showing
9 changed files
with
795 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Redis Cache Store for Moodle | ||
============================ | ||
|
||
A Moodle cache store plugin for [Redis](http://redis.io). | ||
|
||
This plugin requires the [PhpRedis](https://github.com/nicolasff/phpredis) extension. The PhpRedis extension can be installed via PECL with `pecl install redis`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Moodle is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Redis Cache Store - Add instance form | ||
* | ||
* @package cachestore_redis | ||
* @copyright 2013 Adam Durana | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
require_once($CFG->dirroot.'/cache/forms.php'); | ||
|
||
/** | ||
* Form for adding instance of Redis Cache Store. | ||
* | ||
* @copyright 2013 Adam Durana | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class cachestore_redis_addinstance_form extends cachestore_addinstance_form { | ||
/** | ||
* Builds the form for creating an instance. | ||
*/ | ||
protected function configuration_definition() { | ||
$form = $this->_form; | ||
|
||
$form->addElement('text', 'server', get_string('server', 'cachestore_redis'), array('size' => 24)); | ||
$form->setType('server', PARAM_TEXT); | ||
$form->addHelpButton('server', 'server', 'cachestore_redis'); | ||
$form->addRule('server', get_string('required'), 'required'); | ||
|
||
$form->addElement('text', 'prefix', get_string('prefix', 'cachestore_redis'), array('size' => 16)); | ||
$form->setType('prefix', PARAM_TEXT); // We set to text but we have a rule to limit to alphanumext. | ||
$form->addHelpButton('prefix', 'prefix', 'cachestore_redis'); | ||
$form->addRule('prefix', get_string('prefixinvalid', 'cachestore_redis'), 'regex', '#^[a-zA-Z0-9\-_]+$#'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Moodle is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Redis Cache Store - English language strings | ||
* | ||
* @package cachestore_redis | ||
* @copyright 2013 Adam Durana | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
$string['pluginname'] = 'Redis'; | ||
$string['prefix'] = 'Key prefix'; | ||
$string['prefix_help'] = 'This prefix is used for all key names on the Redis server. | ||
* If you only have one Moodle instance using this server, you can leave this value default. | ||
* Due to key length restrictions, a maximum of 5 characters is permitted.'; | ||
$string['prefixinvalid'] = 'Invalid prefix. You can only use a-z A-Z 0-9-_.'; | ||
$string['test_server'] = 'Test Server'; | ||
$string['test_server_desc'] = 'Redis server to use for testing.'; | ||
$string['server'] = 'Server'; | ||
$string['server_help'] = 'This sets the hostname or IP address of the Redis server to use.'; |
Oops, something went wrong.