MDL-29954 repository: remove dead code

Also remove repository_attach_id() which was never used and not useful.
This commit is contained in:
Dan Poltawski 2013-08-23 12:36:02 +08:00
parent d2aa53be1b
commit 033d1634cc
3 changed files with 1 additions and 41 deletions

View File

@ -3226,14 +3226,3 @@ function initialise_filepicker($args) {
}
return $return;
}
/**
* Small function to walk an array to attach repository ID
*
* @param array $value
* @param string $key
* @param int $id
*/
function repository_attach_id(&$value, $key, $id){
$value['repo_id'] = $id;
}

View File

@ -89,36 +89,6 @@ $maxbytes = get_user_max_upload_file_size($context, $CFG->maxbytes, $coursemaxby
// Wait as long as it takes for this script to finish
set_time_limit(0);
// Early actions which need to be done before repository instances initialised
switch ($action) {
// global search
case 'gsearch':
$params = array();
$params['context'] = array(context::instance_by_id($contextid), context_system::instance());
$params['currentcontext'] = context::instance_by_id($contextid);
$repos = repository::get_instances($params);
$list = array();
foreach($repos as $repo){
if ($repo->global_search()) {
$ret = $repo->search($search_text);
array_walk($ret['list'], 'repository_attach_id', $repo->id); // See function below
$tmp = array_merge($list, $ret['list']);
$list = $tmp;
}
}
$listing = array('list'=>$list);
$listing['gsearch'] = true;
die(json_encode($listing));
break;
// remove the cache files & logout
case 'ccache':
$cache = new curl_cache;
$cache->refresh();
$action = 'list';
break;
}
// These actions all occur on the currently active repository instance
switch ($action) {
case 'sign':

View File

@ -7,6 +7,7 @@ http://docs.moodle.org/dev/Repository_API
* get_option() now always return null when the first parameter ($config) is not empty, and
no value was found for this $config. Previously this could sometimes return an empty array().
* The function repository_attach_id() was removed, it was never used and was not useful.
=== 2.5 ===