Differences Between: [Versions 311 and 403]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Redis Cache Store - Add instance form 19 * 20 * @package cachestore_redis 21 * @copyright 2013 Adam Durana 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 defined('MOODLE_INTERNAL') || die(); 26 27 require_once($CFG->dirroot.'/cache/forms.php'); 28 29 /** 30 * Form for adding instance of Redis Cache Store. 31 * 32 * @copyright 2013 Adam Durana 33 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 34 */ 35 class cachestore_redis_addinstance_form extends cachestore_addinstance_form { 36 /** 37 * Builds the form for creating an instance. 38 */ 39 protected function configuration_definition() { 40 $form = $this->_form; 41 42 $form->addElement('text', 'server', get_string('server', 'cachestore_redis'), array('size' => 24)); 43 $form->setType('server', PARAM_TEXT); 44 $form->addHelpButton('server', 'server', 'cachestore_redis'); 45 $form->addRule('server', get_string('required'), 'required'); 46 47 $form->addElement('passwordunmask', 'password', get_string('password', 'cachestore_redis')); 48 $form->setType('password', PARAM_RAW); 49 $form->addHelpButton('password', 'password', 'cachestore_redis'); 50 51 $form->addElement('text', 'prefix', get_string('prefix', 'cachestore_redis'), array('size' => 16)); 52 $form->setType('prefix', PARAM_TEXT); // We set to text but we have a rule to limit to alphanumext. 53 $form->addHelpButton('prefix', 'prefix', 'cachestore_redis'); 54 $form->addRule('prefix', get_string('prefixinvalid', 'cachestore_redis'), 'regex', '#^[a-zA-Z0-9\-_]+$#'); 55 56 $serializeroptions = cachestore_redis::config_get_serializer_options(); 57 $form->addElement('select', 'serializer', get_string('useserializer', 'cachestore_redis'), $serializeroptions); 58 $form->addHelpButton('serializer', 'useserializer', 'cachestore_redis'); 59 $form->setDefault('serializer', Redis::SERIALIZER_PHP); 60 $form->setType('serializer', PARAM_INT); 61 62 $compressoroptions = cachestore_redis::config_get_compressor_options(); 63 $form->addElement('select', 'compressor', get_string('usecompressor', 'cachestore_redis'), $compressoroptions); 64 $form->addHelpButton('compressor', 'usecompressor', 'cachestore_redis'); 65 $form->setDefault('compressor', cachestore_redis::COMPRESSOR_NONE); 66 $form->setType('compressor', PARAM_INT); 67 } 68 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body