diff options
author | Andreas Gohr <andi@splitbrain.org> | 2008-02-23 21:52:54 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2008-02-23 21:52:54 +0100 |
commit | a05e297acbd41dc059369b143e2cadf281a581a1 (patch) | |
tree | ea599c6c71513567e9dddc23e6ac3be21888b22f /inc/media.php | |
parent | b5742ced86ad0a0e0448556d81e6c97c12ae9d9f (diff) | |
download | rpg-a05e297acbd41dc059369b143e2cadf281a581a1.tar.gz rpg-a05e297acbd41dc059369b143e2cadf281a581a1.tar.bz2 |
use fulltext index to search for used media files FS#1336 FS#1275
This changes how DokuWiki looks for reference toa media file which is
about to deleted. Instead of doing a full grep through all pages it now
uses the fulltext index first, then does an exact match on the found
pages.
This speeds up the search significantly on larger wikis. However the
fulltext search limits now apply: images with names shorter than 3 charcters
may not be found.
This needs extensive testing!
darcs-hash:20080223205254-7ad00-486de0a4125d51b4e7999827f710d1d9de8bc60d.gz
Diffstat (limited to 'inc/media.php')
-rw-r--r-- | inc/media.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/inc/media.php b/inc/media.php index efa200d4c..663a35051 100644 --- a/inc/media.php +++ b/inc/media.php @@ -27,13 +27,10 @@ function media_filesinuse($data,$id){ echo '<p>'.hsc($lang['ref_inuse']).'</p>'; $hidden=0; //count of hits without read permission - usort($data,'sort_search_fulltext'); foreach($data as $row){ - if(auth_quickaclcheck($row['id']) >= AUTH_READ){ + if(auth_quickaclcheck($row) >= AUTH_READ && isVisiblePage($row)){ echo '<div class="search_result">'; - echo '<span class="mediaref_ref">'.$row['id'].'</span>'; - echo ': <span class="search_cnt">'.$row['count'].' '.$lang['hits'].'</span><br />'; - echo '<div class="search_snippet">'.$row['snippet'].'</div>'; + echo '<span class="mediaref_ref">'.hsc($row).'</span>'; echo '</div>'; }else $hidden++; @@ -142,6 +139,7 @@ function media_metaform($id,$auth){ echo '</form>'.NL; } + /** * Handles media file deletions * @@ -156,9 +154,11 @@ function media_delete($id,$auth){ global $conf; global $lang; + // check for references if needed $mediareferences = array(); if($conf['refcheck']){ - search($mediareferences,$conf['datadir'],'search_reference',array('query' => $id)); + require_once(DOKU_INC.'inc/fulltext.php'); + $mediareferences = ft_mediause($id,$conf['refshow']); } if(!count($mediareferences)){ |