[pmwiki-users] detecting minor edit

Patrick R. Michaud pmichaud at pobox.com
Tue Feb 13 10:57:22 CST 2007


On Tue, Feb 13, 2007 at 05:51:32PM +0100, sgp wrote:
> Patrick R. Michaud wrote:
> 
> > You might try adding a space between "if" and the opening paren,
> > although I don't think that's it.  Or, perhaps send a copy of your
> > local/config.php and we can look at it.
> 
> Adding spaces didn't help.
> Here's a copy of my local/config.php, comments stripped.
> Line 2 should trigger an error warning when saving a minor edit,
> but it doesn't.
>
> <?php if (!defined('PmWiki')) exit();
> if(@$_POST['diffclass'] == 'minor') {print 1/0;}

Well, it will trigger an error warning only if errors are turned on.
If errors are suppressed then it may not trigger a warning.  Also,
many versions of PHP 4 didn't always treat division by zero as
being an error.

Instead of triggering an error, try sending something to the screen
and then use "preview" instead of save.  In other words, try this:

    <?php if (!defined('PmWiki')) exit();
    if (@$_POST['diffclass'] == 'minor') { print "Minor edit\n"; }
    # ...rest of config

Then edit a page, select "minor edit", and press "Preview".
You should see "Minor edit" and possibly a couple of PHP warnings
at the very top of the resulting page.  (Note that by "very top" 
I mean "above the skin headers".)

If you see that, then you know the code to detect minor edits
is working.  If you don't see it, then something else odd is 
happening.

Pm



More information about the pmwiki-users mailing list