From 9b64ec4dae53573137ebd8a58ded4ecc2a70d581 Mon Sep 17 00:00:00 2001 From: Matteo Scaramuccia Date: Sun, 9 Jun 2013 12:19:54 +0200 Subject: [PATCH] MDL-29218 Repository: Hide the repo if repository::plugin_init returns false --- admin/repository.php | 4 +++- repository/lib.php | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) 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'); }