Created
January 19, 2018 10:00
-
-
Save nadavkav/2e016eb5cdf5634f8d9a4ed02ed32ebb to your computer and use it in GitHub Desktop.
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
<?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