[dokuwiki] Patch: Implicit ~~NOCACHE~~ on files with <php>

  • From: "B.J. Black" <bj@xxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Fri, 16 Nov 2007 00:03:38 -0800

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all!  Long-time user, first-time contributor (I hope :-).

I'm writing a PHP application for work using Dokuwiki as a framework and
have a few small changes I'm using to make life a little easier.

Starting small, I've attached a patch that adds a (configurable) option
to make all pages with PHP code in them implicitly ~~NOCACHE~~.  Caching
has been driving me batty (since I don't need it) and it wasn't
immediately obvious that I needed nocache at first.  Add to that that
I'm an idiot and, of course, always forget to put nocache in new pages
as I write them (so it drives me batty when I'm debugging my code for
the first few iterations).

This patch adds an onoff configuration option "phpimplicitnocache."  I
hope this helps anyone else using dokuwiki as a framework for PHP apps.

Unfortunately, my German is nonexistant and my French and Spanish are an
embarrassment, so I only touched the English i18n...

The patch is (probably) -p1 against a copy freshly pulled from darcs.
Adds 5 total lines to the total code, modifies 0 and deletes 0.

- --bj
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHPU7aBWZe+3ib/AERArg6AJ999n3vGKIFbAwCjQDeLGsYqixajwCeJMMd
QVphbX9g6My5AXnzU32R/Lk=
=jtCK
-----END PGP SIGNATURE-----
diff -Nur darcs/dokuwiki/inc/parser/handler.php 
wjblack/dokuwiki/inc/parser/handler.php
--- darcs/dokuwiki/inc/parser/handler.php       2007-11-16 01:44:34.000000000 
-0500
+++ wjblack/dokuwiki/inc/parser/handler.php     2007-11-16 01:37:39.000000000 
-0500
@@ -270,6 +270,9 @@
         if ( $state == DOKU_LEXER_UNMATCHED ) {
             if ($conf['phpok']) {
                 $this->_addCall('php',array($match), $pos);
+                if ($conf['phpimplicitnocache']) {
+                    $this->_addCall('nocache',array(),$pos);
+                }
             } else {
                 $this->_addCall('file',array($match), $pos);
             }
diff -Nur darcs/dokuwiki/lib/plugins/config/lang/en/lang.php 
wjblack/dokuwiki/lib/plugins/config/lang/en/lang.php
--- darcs/dokuwiki/lib/plugins/config/lang/en/lang.php  2007-11-16 
01:44:34.000000000 -0500
+++ wjblack/dokuwiki/lib/plugins/config/lang/en/lang.php        2007-11-16 
01:28:14.000000000 -0500
@@ -64,6 +64,7 @@
 $lang['typography']  = 'Do typographical replacements';
 $lang['htmlok']      = 'Allow embedded HTML';
 $lang['phpok']       = 'Allow embedded PHP';
+$lang['phpimplicitnocache'] = 'Assume <a 
href="http://wiki.splitbrain.org/wiki:caching";>NOCACHE</a> on pages containing 
PHP code?';
 $lang['dformat']     = 'Date format (see PHP\'s <a 
href="http://www.php.net/date";>date</a> function)';
 $lang['signature']   = 'Signature';
 $lang['toptoclevel'] = 'Top level for table of contents';
diff -Nur darcs/dokuwiki/lib/plugins/config/settings/config.metadata.php 
wjblack/dokuwiki/lib/plugins/config/settings/config.metadata.php
--- darcs/dokuwiki/lib/plugins/config/settings/config.metadata.php      
2007-11-16 01:44:34.000000000 -0500
+++ wjblack/dokuwiki/lib/plugins/config/settings/config.metadata.php    
2007-11-16 01:26:46.000000000 -0500
@@ -133,6 +133,7 @@
 $meta['spellchecker']= array('onoff');
 $meta['htmlok']      = array('onoff');
 $meta['phpok']       = array('onoff');
+$meta['phpimplicitnocache'] = array('onoff');
 $meta['notify']      = array('email');
 $meta['subscribers'] = array('onoff');
 $meta['locktime']    = array('numeric');

Other related posts: