Manual talk:Hooks/ArticleSaveComplete
Add topicSo, how to install this? just copy $wgHooks['ArticleSave'][] = 'fnMyHook'; to LocalSettings.php?--Alnokta 05:52, 22 April 2007 (UTC)
Missing parameter
[edit]The parameter 'revision' is missing from the declaration. From MW 1.11:
wfRunHooks( 'ArticleSaveComplete', array( &$this, &$wgUser, $text, $summary,
$flags & EDIT_MINOR, null, null, &$flags, $revision ) );
Jean-Lou Dupont 23:39, 8 October 2007 (UTC)
Outdated
[edit]Some of the information seems to be outdated (for example, "$isminor" seems to have been replaced with "$minor_edit"?), could someone update it please? I would myself but I'm not sure about some of this stuff... hence why I'm looking it up. :P --NightKev 07:00, 12 February 2009 (UTC)
- I also found that &$minoredit needed to be replaced with $minoredit. Tisane 09:08, 11 March 2010 (UTC)
Differences in parameter declaration
[edit]Why is there a difference in the way some of the parameters are declared. My question is because of a bug I had in one extension, where using the $revision parameter. I copied the declaration of the function for the hook from this page. When performing concurent edits on the same page this resulted in an error on a call on the $revision object, it was no longer available. Changing the declaration of $revision to &$revision (passing it by reference) fixed the problem. As I'm not a php-wizz, can anybody tell me if the declaration prototype of this hook on this page needs to be updated and more consistent. What should be the correct declaration, for which parameters, and is there a guideline?
--Carter040 11:31, 7 October 2009 (UTC)
$watchthis should not a reference
[edit]The model function declaration in the article states that $watchthis
is passed as a reference. Actually a null value is passed, and defining a function for this hook with &$watchthis
will produce a PHP warning and cause the hook to fail with:
- Parameter 6 to NotifyArticleSaved() expected to be a reference, value given in /var/www/acawiki.org/www/includes/Hooks.php on line 133
--Nkinkade 19:23, 10 February 2011 (UTC)
PHP Warning: Missing argument 12 in extension that uses ArticleSaveComplete
[edit]Hi, we get an "PHP Warning: Missing argument 12" error message in the apache 2 error log in /var/log/httpd/error_log when calling an extension that is based on the ArticleSaveComplete hook. This extension worked without any error in MW 1.15.x, but when we upgraded to MW 1.18.1 resp. MW 1.19.1 we faced error messages like this:
[Wed Jun 27 16:53:07 2012] [error] [client x.x.x.x] PHP Warning: Missing argument 12 for myExtension::onArticleSaveComplete() in /usr/local/mediawiki-1.19.1/extensions/myExtension/myExtension.body.php on line 58, referer: http://y.y.y.y/mediawiki/index.php?title=TEST/Test/TestSeite&action=edit&redlink=1
In the myExtension.php:
[...]
$wgHooks['ArticleSaveComplete'][] = array ( $wgmyExtensionObject, 'onArticleSaveComplete' );
[...]
In the myExtension.body.php:
[...]
public function onArticleSaveComplete( &$article, &$user, $text, $summary, $minoredit, $watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId, &$redirect ) {
[...]
}
[...]
The error seems to to refer to the &$redirect parameter. Searching for changes in the hook interface since MW 1.15.x did not show up any results...
Any hints are welcome...!
Thanks in advance!!
--Frank 14:45, 29 June 2012 (UTC)
- It looks like
&$redirect
was taken out of there, and no one updated Manual:Hooks/ArticleSaveComplete to reflect the change. Here is what I'm currently seeing at WikiPage::doEdit:
wfRunHooks( 'ArticleSaveComplete', array( &$this, &$user, $text, $summary, $flags & EDIT_MINOR, null, null, &$flags, $revision, &$status, $baseRevId ) );
Leucosticte (talk) 06:45, 3 September 2012 (UTC)
- Thanks for this investigation, Leucosticte!
- Extension:Access Log and the UMEduWiki package, which includes this extension are affected by this bug as well. In their case, the wrongly added 12th parameter can just be removed from accessLogEditAction() in wiki\extensions\UMEduWiki\AccessLog\AccessLog.php.
- See Topic:T9dvyz55tcucsiks. --87.123.37.221 15:11, 10 August 2016 (UTC)