MDL-29218 Repository: Hide the repo if repository::plugin_init returns false
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user