Skip to content

Instantly share code, notes, and snippets.

@nadavkav
Created January 19, 2018 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nadavkav/2e016eb5cdf5634f8d9a4ed02ed32ebb to your computer and use it in GitHub Desktop.
Save nadavkav/2e016eb5cdf5634f8d9a4ed02ed32ebb to your computer and use it in GitHub Desktop.
<?php
// Moosh/Command/Moodle23/Config/ConfigGet.php
/**
* moosh - Moodle Shell
*
* @copyright 2012 onwards Tomasz Muras
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace Moosh\Command\Moodle23\Config;
use Moosh\MooshCommand;
class ConfigGet extends MooshCommand
{
public function __construct()
{
parent::__construct('get', 'config');
$this->minArguments = 0;
$this->maxArguments = 2;
}
public function execute()
{
global $CFG, $DB;
$name = NULL;
$plugin = NULL;
if(isset($this->arguments[0])) {
$plugin = trim($this->arguments[0]);
}
if(isset($this->arguments[1])) {
$name = trim($this->arguments[1]);
}
//print_r(get_config($plugin,$name));
$pluginconfiguration = get_config($plugin,$name);
foreach ($pluginconfiguration as $setting => $value) {
echo "\$defaults[‘$plugin'][‘$setting'] = $value\n";
}
echo "\n";
}
protected function getArgumentsHelp()
{
$ret = "\n\nARGUMENTS:";
$ret .= "\n\t";
$ret .= "<plugin> <name>";
return $ret;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment