Not logged in. · Lost password · Register
Forum: General Help and Support Development RSS
Unable to get COMMON_WIKIPAGE_SAVE hook to be called
Avatar
clh #1
Member since May 2016 · 94 posts
Group memberships: Members
Show profile · Link to this post
Subject: Unable to get COMMON_WIKIPAGE_SAVE hook to be called
I believe I've followed the example shown in the struct plugin, as recommended by the doc for COMMON_WIKIPAGE_SAVE, but the hooks I register are not being driven when I save a page.

Below, the dbglog shows the "Registering..." event, but the log messages from the handlers isn't seen:

class action_plugin_checkout_foocomponent extends DokuWiki_Action_Plugin {
/**
 * Registers a callback function for a given event
 *
 * @param Doku_Event_Handler $controller DokuWiki's event controller object
 * @returnvoid
*/
public function register(Doku_Event_Handler $controller)
{
    dbglog("Registering COMMON_WIKIPAGE_SAVE hooks");
    $controller->register_hook('COMMON_WIKIPAGE_SAVE', 'BEFORE', $this,'handle_pagesave_before',array());
    $controller->register_hook('COMMON_WIKIPAGE_SAVE', 'AFTER', $this, 'handle_pagesave_after', array());
}
/**
 * This is just a no-op, in case it needs to be here
 */
public function handle_pagesave_before(Doku_Event $event, $param)
{
    dbglog("handle_pagesave_before 1");
    dbglog("id='" . $event->data['id'] . "'");
    return true;
}
   
/**
 * A page is being saved to disk. If it is a Draft, and if the content
 * is empty (indicating the page is to be deleted), regenerate the
 * Draft index.
 *
 * Currently hardcoded to look for ':draft:*' being saved.
 *
 * @param Doku_Event $event
 *          the DokuWiki event
 * @param mixed $param
 *          not used
 *
 */
public function handle_pagesave_after(Doku_Event $event, $param)
{
    dbglog("handle_pagesave_after 1");
    $drafts_ns = 'drafts';
    dbglog("id='" . $event->data['id'] . "'");
    if ($event->data['changeType'] == DOKU_CHANGE_TYPE_DELETE ) {
      // clear all data on delete unless it's a move operation
    }
    return true;
Avatar
turnermm (Moderator) #2
Member since Oct 2009 · 4785 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
Works for me using dw's msg.  Perhaps it something in your dbblog function.
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Avatar
LarsDW223 #3
Member since Sep 2014 · 462 posts · Location: Paderborn
Group memberships: Members
Show profile · Link to this post
Did you switch on config option allowdebug? See https://www.dokuwiki.org/devel:debugging?s[]=dbglog.
Avatar
clh #4
Member since May 2016 · 94 posts
Group memberships: Members
Show profile · Link to this post
Yes - allowdebug is set. The dbglog message from the register() function appears in the log, as expected. However, the dbglog messages from handle_pagesave_before() and _after() do not appear in the log.
Avatar
clh #5
Member since May 2016 · 94 posts
Group memberships: Members
Show profile · Link to this post
OTOH, this might be the problem:

$ php -v
PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php.ini on line 440 in Unknown on line 0
PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php.ini on line 450 in Unknown on line 0
PHP 5.3.3 (cli) (built: May 10 2016 21:39:50)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

 :nuts:
Avatar
LarsDW223 #6
Member since Sep 2014 · 462 posts · Location: Paderborn
Group memberships: Members
Show profile · Link to this post
Actually you should have PHP version 5.6 or higher. See https://www.dokuwiki.org/requirements.
Avatar
clh #7
Member since May 2016 · 94 posts
Group memberships: Members
Show profile · Link to this post
Subject: (explained)
It turns out we're not running Frusterick Manners - we're running Detritus:-(

Sorry to have wasted anyone's cycles. I just assumed ... etc.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2020-02-26, 14:27:04 (UTC +01:00)