Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403] [Versions 402 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('advcheckbox', 'encryption', get_string('encrypt_connection', 'cachestore_redis')); 48 $form->setType('encryption', PARAM_BOOL); 49 $form->addHelpButton('encryption', 'encrypt_connection', 'cachestore_redis'); 50 51 $form->addElement('text', 'cafile', get_string('ca_file', 'cachestore_redis')); 52 $form->setType('cafile', PARAM_TEXT); 53 $form->addHelpButton('cafile', 'ca_file', 'cachestore_redis'); 54 55 $form->addElement('passwordunmask', 'password', get_string('password', 'cachestore_redis')); 56 $form->setType('password', PARAM_RAW); 57 $form->addHelpButton('password', 'password', 'cachestore_redis'); 58 59 $form->addElement('text', 'prefix', get_string('prefix', 'cachestore_redis'), array('size' => 16)); 60 $form->setType('prefix', PARAM_TEXT); // We set to text but we have a rule to limit to alphanumext. 61 $form->addHelpButton('prefix', 'prefix', 'cachestore_redis'); 62 $form->addRule('prefix', get_string('prefixinvalid', 'cachestore_redis'), 'regex', '#^[a-zA-Z0-9\-_]+$#'); 63 64 $serializeroptions = cachestore_redis::config_get_serializer_options(); 65 $form->addElement('select', 'serializer', get_string('useserializer', 'cachestore_redis'), $serializeroptions); 66 $form->addHelpButton('serializer', 'useserializer', 'cachestore_redis'); 67 $form->setDefault('serializer', Redis::SERIALIZER_PHP); 68 $form->setType('serializer', PARAM_INT); 69 70 $compressoroptions = cachestore_redis::config_get_compressor_options(); 71 $form->addElement('select', 'compressor', get_string('usecompressor', 'cachestore_redis'), $compressoroptions); 72 $form->addHelpButton('compressor', 'usecompressor', 'cachestore_redis'); 73 $form->setDefault('compressor', cachestore_redis::COMPRESSOR_NONE); 74 $form->setType('compressor', PARAM_INT); 75 } 76 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body