[dokuwiki] Re: [patch] don't display zero length files in search

  • From: Robin Getz <rgetz@xxxxxxxxxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Mon, 25 Oct 2010 10:02:18 -0400

On Mon 11 Oct 2010 13:30, Robin Getz pondered:
> On Wed 29 Sep 2010 09:05, Robin Getz pondered:
> > This culls zero length files from search results, and the index.
> 
> Ping?

So, I guess the right thing to do, is just add a new event, and send a patch?


Any feedback on the below?


> Any other suggestions to get http://www.dokuwiki.org/plugin:redirect
> to show "avaliable" links? The only thing I can think of is to change
> page_exists to trigger an event that the plugin could capture, but I
> would think that would be much higher overhead that the proposed
> solution...???
> 
> Thanks
> 
> > --- a/inc/pageutils.php
> > +++ b/inc/pageutils.php
> > @@ -232,7 +232,9 @@ function sectionID($title,&$check) {
> >   * @author Chris Smith <chris@xxxxxxxxxxxxx>
> >   */
> >  function page_exists($id,$rev='',$clean=true) {
> > -    return @file_exists(wikiFN($id,$rev,$clean));
> > +    $pg = wikiFN($id,$rev,$clean);
> > +    $ret = @file_exists($pg) && filesize($pg);
> > +    return $ret;
> >  }
> > --- a/inc/search.php
> > +++ b/inc/search.php
> > @@ -31,6 +31,7 @@ function search(&$data,$base,$func,$opts,$dir='',$lvl=1){
> >      if(!$dh) return;
> >      while(($file = readdir($dh)) !== false){
> >          if(preg_match('/^[\._]/',$file)) continue; //skip hidden files and 
> > upper dirs
> > +        if(!filesize($base.'/'.$dir.'/'.$file)) continue; // skip zero 
> > length files
> >          if(is_dir($base.'/'.$dir.'/'.$file)){
> >              $dirs[] = $dir.'/'.$file;
> >              continue;
> > 
> > 
-- 
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: