Skip to content

Commit

Permalink
MDL-14589 fixed area tree generation
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Jul 4, 2009
1 parent 65635c0 commit 3b60767
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/file/file_storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ public function get_area_tree($contextid, $filearea, $itemid) {
$parts = explode('/', trim($dir->get_filepath(),'/'));
$pointer =& $result;
foreach ($parts as $part) {
if ($part === '') {
continue;
}
if (!isset($pointer['subdirs'][$part])) {
$pointer['subdirs'][$part] = array('dirname'=>$part, 'dirfile'=>null, 'subdirs'=>array(), 'files'=>array());
}
Expand All @@ -246,6 +249,9 @@ public function get_area_tree($contextid, $filearea, $itemid) {
$parts = explode('/', trim($file->get_filepath(),'/'));
$pointer =& $result;
foreach ($parts as $part) {
if ($part === '') {
continue;
}
$pointer =& $pointer['subdirs'][$part];
}
$pointer['files'][$file->get_filename()] = $file;
Expand Down

0 comments on commit 3b60767

Please sign in to comment.