Manual talk:Hooks/ArticleSaveComplete

From MediaWiki.org
Jump to: navigation, search

So, how to install this? just copy $wgHooks['ArticleSave'][] = 'fnMyHook'; to LocalSettings.php?--Alnokta 05:52, 22 April 2007 (UTC)

Contents

[edit] Missing parameter

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)

[edit] Outdated

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)

[edit] Differences in parameter declaration

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)

[edit] $watchthis should not a reference

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)

Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Print/export
Toolbox