Merge branch 'm26_MDL-29218_plugin_init_not_blocking_when_false' of https://github.com/scara/moodle

This commit is contained in:
Damyon Wiese 2013-09-03 14:25:43 +08:00
commit 060615d347
2 changed files with 6 additions and 11 deletions

View File

@ -143,8 +143,10 @@ if (($action == 'edit') || ($action == 'new')) {
$success = $repositorytype->update_options($settings); $success = $repositorytype->update_options($settings);
} else { } else {
$type = new repository_type($plugin, (array)$fromform, $visible); $type = new repository_type($plugin, (array)$fromform, $visible);
$type->create();
$success = true; $success = true;
if (!$repoid = $type->create()) {
$success = false;
}
$data = data_submitted(); $data = data_submitted();
} }
if ($success) { if ($success) {

View File

@ -255,6 +255,7 @@ class repository_type implements cacheable_object {
} }
//run plugin_init function //run plugin_init function
if (!repository::static_function($this->_typename, 'plugin_init')) { if (!repository::static_function($this->_typename, 'plugin_init')) {
$this->update_visibility(false);
if (!$silent) { if (!$silent) {
throw new repository_exception('cannotinitplugin', 'repository'); throw new repository_exception('cannotinitplugin', 'repository');
} }
@ -1139,7 +1140,7 @@ abstract class repository implements cacheable_object {
* *
* @static * @static
* @param string $plugin repository plugin name * @param string $plugin repository plugin name
* @param string $function funciton name * @param string $function function name
* @return mixed * @return mixed
*/ */
public static function static_function($plugin, $function) { public static function static_function($plugin, $function) {
@ -1152,14 +1153,6 @@ abstract class repository implements cacheable_object {
return false; return false;
} }
$pname = null;
if (is_object($plugin) || is_array($plugin)) {
$plugin = (object)$plugin;
$pname = $plugin->name;
} else {
$pname = $plugin;
}
$args = func_get_args(); $args = func_get_args();
if (count($args) <= 2) { if (count($args) <= 2) {
$args = array(); $args = array();
@ -2437,7 +2430,7 @@ abstract class repository implements cacheable_object {
/** /**
* For oauth like external authentication, when external repository direct user back to moodle, * For oauth like external authentication, when external repository direct user back to moodle,
* this funciton will be called to set up token and token_secret * this function will be called to set up token and token_secret
*/ */
public function callback() { public function callback() {
} }