mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 20:50:21 +01:00
MDL-15402: Repository admin: delete a repository type => the general options (example: API key) are now deleted from config_plugin table
This commit is contained in:
parent
783b6db46b
commit
eb239694de
@ -60,7 +60,8 @@ require_once(dirname(dirname(__FILE__)).'/lib/formslib.php');
|
||||
* - a repository_type object is mapped to the "repository" database table
|
||||
* - "typename" attibut maps the "type" database field. It is unique.
|
||||
* - general "options" for a repository type are saved in the config_plugin table
|
||||
* - TODO: when you delete a repository, all instances are deleted
|
||||
* - when you delete a repository, all instances are deleted, and general
|
||||
* options are also deleted from database
|
||||
* - When you create a type for a plugin that can't have multiple instances, a
|
||||
* instance is automatically created.
|
||||
*/
|
||||
@ -340,8 +341,8 @@ class repository_type {
|
||||
|
||||
|
||||
/**
|
||||
* Delete a repository_type - DO NOT CALL IT TILL THE TODO IS DONE
|
||||
* TODO: delete all instances for this type
|
||||
* Delete a repository_type (general options are removed from config_plugin
|
||||
* table, and all instances are deleted)
|
||||
* @global object $DB
|
||||
* @return boolean
|
||||
*/
|
||||
@ -354,6 +355,11 @@ class repository_type {
|
||||
$instance->delete();
|
||||
}
|
||||
|
||||
//delete all general options
|
||||
foreach ($this->_options as $name => $value){
|
||||
set_config($name, null, $this->_typename);
|
||||
}
|
||||
|
||||
return $DB->delete_records('repository', array('type' => $this->_typename));
|
||||
}
|
||||
}
|
||||
@ -549,6 +555,12 @@ abstract class repository {
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: write documentation here
|
||||
* @global <type> $DB
|
||||
* @return <type>
|
||||
*/
|
||||
public function get_name(){
|
||||
global $DB;
|
||||
// We always verify instance id from database,
|
||||
|
Loading…
x
Reference in New Issue
Block a user