MDL-29218 Repository: Hide the repo if repository::plugin_init returns false

This commit is contained in:
Matteo Scaramuccia
2013-09-02 23:09:20 +02:00
parent ee788142f2
commit 9b64ec4dae
2 changed files with 4 additions and 1 deletions
+3 -1
View File
@@ -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) {
+1
View File
@@ -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');
}