diff --git a/admin/repository.php b/admin/repository.php index 50a08ee2bbc..8f976cf3222 100644 --- a/admin/repository.php +++ b/admin/repository.php @@ -143,8 +143,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 8c197ce30cb..79c7ecb39e5 100644 --- a/repository/lib.php +++ b/repository/lib.php @@ -255,6 +255,7 @@ class repository_type implements cacheable_object { } //run plugin_init function if (!repository::static_function($this->_typename, 'plugin_init')) { + $this->update_visibility(false); if (!$silent) { throw new repository_exception('cannotinitplugin', 'repository'); }