use vmoodleadminset_roles\Command_Role_Compare; use vmoodleadminset_roles\Command_Role_Capability_Sync; use vmoodleadminset_upgrade\Command_Upgrade; use vmoodleadminset_sql\Command_Sql; use vmoodleadminset_sql\Command_MultiSql; use vmoodleadminset_test\CommandWrapper; use Exception; /** * Description of assisted commands for testing generic oommands. * * @package local_vmoodle * @category local * @author Bruce Bujon (bruce.bujon@gmail.com) */ // Creating category $category = new Command_Category('test'); // Adding commands $cmd = new Command_Sql('Command 1', 'Command without parameter.', 'SELECT aa FROM bb'); $category->addCommand($cmd); /********************************/ $cmd = new Command_Sql('Command 2', 'Command with a boolean parameter.', 'SELECT [[?parameter1]] FROM bb', new Command_Parameter('parameter1', 'boolean', 'The boolean')); $category->addCommand($cmd); /********************************/ $cmd = new Command_Sql('Command 3', 'Command with a boolean parameter selected.', 'SELECT [[?parameter1]] FROM bb', new Command_Parameter('parameter1', 'boolean', 'The boolean selected by default', true)); $category->addCommand($cmd); /********************************/ $cmd = new Command_Sql('Command 4', 'Command with a boolean parameter unselected.', 'SELECT [[?parameter1]] FROM bb', new Command_Parameter('parameter1', 'boolean', 'The boolean unselected by default', false)); $category->addCommand($cmd); /********************************/ $param1 = new Command_Parameter('parameter1', 'enum', 'The enum choice', null, array('value1' => vmoodle_get_string('value1', 'vmoodleadminset_test'), 'value2' => vmoodle_get_string('value2', 'vmoodleadminset_test'), 'value3' => vmoodle_get_string('value3', 'vmoodleadminset_test'))); $cmd = new Command_Sql('Command 5', 'Command with an enum choice without default value.', 'SELECT [[?parameter1]] FROM bb', $param1);
use vmoodleadminset_sql\Command_Sql; function vmoodle_config_get_plugins_params() { global $CFG, $DB; $paramslist = $DB->get_records_sql_menu("SELECT DISTINCT id,CONCAT(plugin,'/',name) FROM {config_plugins} "); $paramlist = array_combine(array_values($paramslist), array_values($paramslist)); return $paramlist; } function vmoodle_config_get_params() { global $CFG, $DB; $paramslist = $DB->get_records_sql_menu("SELECT DISTINCT id,name FROM {config} "); $paramlist = array_combine(array_values($paramslist), array_values($paramslist)); return $paramlist; } $category = new Command_Category('generic'); // Set on/off the maintenance mode $param1 = new Command_Parameter('source1', 'boolean', 'Maintenance mode', null, null); $param2 = new Command_Parameter('source2', 'ltext', 'Maintenance message', null, null); $cmd = new Command_MultiSql('Vmoodle Maintenance', 'Setting on/off the maintenance mode', 'UPDATE {config} SET value = [[?source1]] WHERE name = \'maintenance_enabled\' ' . ";\n" . ' UPDATE {config} SET value = [[?source2]] WHERE name = \'maintenance_message\'', array($param1, $param2)); $category->addCommand($cmd); $cmd = new Command_PurgeCaches('Vmoodle Purge Caches', 'Purge remote caches'); $category->addCommand($cmd); // Distribute a config value to all nodes (Using Generic SQL) /* $param1 = new Command_Parameter( 'source1', 'enum', 'Config Key', null, vmoodle_config_get_params()
<?php use local_vmoodle\commands\Command_Category; use vmoodleadminset_plugins\Command_Plugin_Set_State; use vmoodleadminset_plugins\Command_Plugins_Sync; use vmoodleadminset_plugins\Command_Plugins_Compare; /** * Description of assisted commands for role purpose. * * @package local_vmoodle * @category local * @author Valery Fremaux (valery.fremaux@gmail.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL */ // Creating category $category = new Command_Category('plugins'); // Adding commands $category->addCommand(new Command_Plugin_Set_State()); $category->addCommand(new Command_Plugins_Sync()); $category->addCommand(new Command_Plugins_Compare()); // Returning the category return $category;
<?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/>. /** * Description of assisted commands for code upgrading. * * @package local_vmoodle * @category local * @author Bruce Bujon (bruce.bujon@gmail.com) */ namespace vmoodleadminset_upgrade; use local_vmoodle\commands\Command_Category; // Creating category $category = new Command_Category('upgrade'); $category->addCommand(new Command_Upgrade('Upgrade databases', 'Drives the logical upgrade of all Moodles in the network')); return $category;
// 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/>. /** * Description of assisted commands for role purpose. * * @package local_vmoodle * @category local * @author Bruce Bujon (bruce.bujon@gmail.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL */ namespace vmoodleadminset_roles; use local_vmoodle\commands\Command_Category; // Creating category $category = new Command_Category('roles'); // Adding commands $category->addCommand(new Command_Role_Sync()); $category->addCommand(new Command_Role_Compare()); $category->addCommand(new Command_Role_Allow_Sync()); $category->addCommand(new Command_Role_Allow_Compare()); // Returning the category return $category;