Skip to content

Commit

Permalink
MDL-29954 repository: remove dead code
Browse files Browse the repository at this point in the history
Also remove repository_attach_id() which was never used and not useful.
  • Loading branch information
danpoltawski committed Aug 28, 2013
1 parent d2aa53b commit 033d163
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 41 deletions.
11 changes: 0 additions & 11 deletions repository/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
30 changes: 0 additions & 30 deletions repository/repository_ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,36 +89,6 @@
// 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':
Expand Down
1 change: 1 addition & 0 deletions repository/upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ===

Expand Down

0 comments on commit 033d163

Please sign in to comment.