diff --git a/admin/repository.php b/admin/repository.php index 3eb48b0da4d..f2aa3934e91 100644 --- a/admin/repository.php +++ b/admin/repository.php @@ -140,8 +140,10 @@ if (($action == 'edit') || ($action == 'new')) { $success = $repositorytype->update_options($settings); } else { $type = new repository_type($plugin, (array)$fromform, $visible); - $type->create(); $success = true; + if (!$repoid = $type->create()) { + $success = false; + } $data = data_submitted(); } if ($success) { diff --git a/repository/lib.php b/repository/lib.php index 42ed8886535..8ddb378ff4c 100644 --- a/repository/lib.php +++ b/repository/lib.php @@ -255,6 +255,7 @@ class repository_type { } //run plugin_init function if (!repository::static_function($this->_typename, 'plugin_init')) { + $this->update_visibility(false); if (!$silent) { throw new repository_exception('cannotinitplugin', 'repository'); } @@ -1074,7 +1075,7 @@ abstract class repository { * * @static * @param string $plugin repository plugin name - * @param string $function funciton name + * @param string $function function name * @return mixed */ public static function static_function($plugin, $function) { @@ -1087,14 +1088,6 @@ abstract class repository { return false; } - $pname = null; - if (is_object($plugin) || is_array($plugin)) { - $plugin = (object)$plugin; - $pname = $plugin->name; - } else { - $pname = $plugin; - } - $args = func_get_args(); if (count($args) <= 2) { $args = array(); @@ -2306,7 +2299,7 @@ abstract class repository { /** * 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() { }