[dokuwiki] Ignoring all files/dirs that match a given RegExp (e.g. ^CVS$)

  • From: Reinhold Kainhofer <reinhold@xxxxxxxxxxxxx>
  • To: DokuWiki Developer Mailingliste <dokuwiki@xxxxxxxxxxxxx>
  • Date: Thu, 31 Aug 2006 19:19:34 +0200

Hi, 
As I keep all pages and media files of my dokuwiki installation in CVS, I have 
a directory named CVS in every directory. Now, of course dokuwiki understands 
these as namespaces and shows them in all namespace lists.

Attached is a patch for the latest stable version ( 2006-03-09b ) which adds a 
configure key that holds a RegExp that will be used to ignore matching 
dirs/files.

So, if you add 
  $conf['ignorepattern'] = '^CVS$';
to your conf/local.php, then all CVS/ directories will be ignored 

Cheers,
Reinhold
-- 
------------------------------------------------------------------
Reinhold Kainhofer, Vienna University of Technology, Austria
email: reinhold@xxxxxxxxxxxxx, http://reinhold.kainhofer.com/
 * Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at/
 * K Desktop Environment, http://www.kde.org, KOrganizer maintainer
 * Chorvereinigung "Jung-Wien", http://www.jung-wien.at/
Index: inc/search.php
===================================================================
RCS file: /data/reinhold/CVS/www.jung-wien.at/mitglieder/inc/search.php,v
retrieving revision 1.2
diff -u -r1.2 search.php
--- inc/search.php      23 Aug 2006 14:04:34 -0000      1.2
+++ inc/search.php      31 Aug 2006 17:10:20 -0000
@@ -20,12 +20,14 @@
 function search(&$data,$base,$func,$opts,$dir='',$lvl=1){
   $dirs   = array();
   $files  = array();
+  global $conf;
 
   //read in directories and files
   $dh = @opendir($base.'/'.$dir);
   if(!$dh) return;
   while(($file = readdir($dh)) !== false){
     if(preg_match('/^[\._]/',$file)) continue; //skip hidden files and upper 
dirs
+    if($conf['ignorepattern'] && preg_match('/'.$conf['ignorepattern'].'/', 
$file ) ) continue; // skip all files that match a pre-configured pattern
     if(is_dir($base.'/'.$dir.'/'.$file)){
       $dirs[] = $dir.'/'.$file;
       continue;
Index: conf/dokuwiki.php
===================================================================
RCS file: /data/reinhold/CVS/www.jung-wien.at/mitglieder/conf/dokuwiki.php,v
retrieving revision 1.3
diff -u -r1.3 dokuwiki.php
--- conf/dokuwiki.php   23 Aug 2006 14:04:34 -0000      1.3
+++ conf/dokuwiki.php   31 Aug 2006 17:10:20 -0000
@@ -93,6 +93,10 @@
                                          //  'page'    - the revised page 
itself
                                          //  'rev'     - page showing all 
revisions
                                          //  'current' - most recent revision 
of page
+$conf['ignorepattern'] = '';             // RegExp to ignore certain files and 
directories, 
+                                         // e.g. a value of "^CVS$" will 
ignore all files and directories 
+                                         // named exactly "CVS" (which are 
control directories for the 
+                                         // revision control system cvs)
 
 //Set target to use when creating links - leave empty for same window
 $conf['target']['wiki']      = '';

Other related posts: