r55449 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55448‎ | r55449 | r55450 >
Date:21:51, 21 August 2009
Author:brion
Status:ok
Tags:
Comment:
Cleaning up some old PHP 4 object-reference usage in some edit filtering hooks.
There was a mix of uses of the reference and non-uses of the reference. :)
Reverts r53714 and fixes it from the other end by cleaning up the uses to not expect references.
Modified paths:
  • /trunk/extensions/AssertEdit/AssertEdit.php (modified) (history)
  • /trunk/extensions/ConfirmEdit/ConfirmEdit_body.php (modified) (history)
  • /trunk/extensions/SpamBlacklist/SpamBlacklist.php (modified) (history)
  • /trunk/extensions/TodoTasks/SpecialTaskList_body.php (modified) (history)
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/api/ApiEditPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -282,7 +282,7 @@
283283 if $resultArr was filled.
284284 $EditPage : the EditPage object
285285 $text : the new text of the article (has yet to be saved)
286 -$resultArr : data in this array will be added to the API result
 286+&$resultArr : data in this array will be added to the API result
287287
288288 'APIGetAllowedParams': use this hook to modify a module's parameters.
289289 &$module: Module object
@@ -621,7 +621,7 @@
622622 'EditFilterMerged': Post-section-merge edit filter
623623 $editor: EditPage instance (object)
624624 $text: content of the edit box
625 -$error: error message to return
 625+&$error: error message to return
626626 $summary: Edit summary for page
627627
628628 'EditFormPreloadText': Allows population of the edit form when creating
@@ -631,7 +631,7 @@
632632
633633 'EditPage::attemptSave': called before an article is
634634 saved, that is before insertNewArticle() is called
635 -&$editpage_Obj: the current EditPage object
 635+$editpage_Obj: the current EditPage object
636636
637637 'EditPage::importFormData': allow extensions to read additional data
638638 posted in the form
Index: trunk/phase3/includes/EditPage.php
@@ -365,7 +365,7 @@
366366 function edit() {
367367 global $wgOut, $wgRequest, $wgEnableJS2system;
368368 // Allow extensions to modify/prevent this form or submission
369 - if ( !wfRunHooks( 'AlternateEdit', array( &$this ) ) ) {
 369+ if ( !wfRunHooks( 'AlternateEdit', array( $this ) ) ) {
370370 return;
371371 }
372372
@@ -675,7 +675,7 @@
676676 wfProfileOut( $fname );
677677
678678 // Allow extensions to modify form data
679 - wfRunHooks( 'EditPage::importFormData', array( &$this, $request ) );
 679+ wfRunHooks( 'EditPage::importFormData', array( $this, $request ) );
680680 }
681681
682682 /**
@@ -767,7 +767,7 @@
768768 wfProfileIn( $fname );
769769 wfProfileIn( "$fname-checks" );
770770
771 - if ( !wfRunHooks( 'EditPage::attemptSave', array( &$this ) ) )
 771+ if ( !wfRunHooks( 'EditPage::attemptSave', array( $this ) ) )
772772 {
773773 wfDebug( "Hook 'EditPage::attemptSave' aborted article saving\n" );
774774 return self::AS_HOOK_ERROR;
@@ -886,7 +886,7 @@
887887 }
888888
889889 // Run post-section-merge edit filter
890 - if ( !wfRunHooks( 'EditFilterMerged', array( &$this, $this->textbox1, &$this->hookError, $this->summary ) ) ) {
 890+ if ( !wfRunHooks( 'EditFilterMerged', array( $this, $this->textbox1, &$this->hookError, $this->summary ) ) ) {
891891 # Error messages etc. could be handled within the hook...
892892 wfProfileOut( $fname );
893893 return self::AS_HOOK_ERROR;
@@ -974,7 +974,7 @@
975975 $oldtext = $this->mArticle->getContent();
976976
977977 // Run post-section-merge edit filter
978 - if ( !wfRunHooks( 'EditFilterMerged', array( &$this, $text, &$this->hookError, $this->summary ) ) ) {
 978+ if ( !wfRunHooks( 'EditFilterMerged', array( $this, $text, &$this->hookError, $this->summary ) ) ) {
979979 # Error messages etc. could be handled within the hook...
980980 wfProfileOut( $fname );
981981 return self::AS_HOOK_ERROR;
Index: trunk/phase3/includes/api/ApiEditPage.php
@@ -214,7 +214,7 @@
215215 if(!is_null($params['captchaword']))
216216 $wgRequest->setVal( 'wpCaptchaWord', $params['captchaword'] );
217217 $r = array();
218 - if(!wfRunHooks('APIEditBeforeSave', array(&$ep, $ep->textbox1, &$r)))
 218+ if(!wfRunHooks('APIEditBeforeSave', array($ep, $ep->textbox1, &$r)))
219219 {
220220 if(count($r))
221221 {
Index: trunk/extensions/ConfirmEdit/ConfirmEdit_body.php
@@ -23,7 +23,7 @@
2424 return self::getInstance()->confirmEditMerged( $editPage, $newtext );
2525 }
2626
27 - static function confirmEditAPI( &$editPage, $newtext, &$resultArr ) {
 27+ static function confirmEditAPI( $editPage, $newtext, &$resultArr ) {
2828 return self::getInstance()->confirmEditAPI( $editPage, $newtext, $resultArr );
2929 }
3030
@@ -509,7 +509,7 @@
510510 }
511511
512512
513 - function confirmEditAPI( &$editPage, $newtext, &$resultArr ) {
 513+ function confirmEditAPI( $editPage, $newtext, &$resultArr ) {
514514 if ( !$this->doConfirmEdit( $editPage, $newtext, false, false ) ) {
515515 $this->addCaptchaAPI( $resultArr );
516516 return false;
Index: trunk/extensions/SpamBlacklist/SpamBlacklist.php
@@ -80,7 +80,7 @@
8181 /**
8282 * Hook function for EditFilterMerged, replaces wfSpamBlacklistFilter
8383 */
84 -function wfSpamBlacklistFilterMerged( &$editPage, $text, &$hookErr, $editSummary ) {
 84+function wfSpamBlacklistFilterMerged( $editPage, $text, &$hookErr, $editSummary ) {
8585 global $wgTitle;
8686 if( is_null( $wgTitle ) ) {
8787 # API mode
@@ -99,7 +99,7 @@
100100 /**
101101 * Hook function for APIEditBeforeSave
102102 */
103 -function wfSpamBlacklistFilterAPIEditBeforeSave( &$editPage, $text, &$resultArr ) {
 103+function wfSpamBlacklistFilterAPIEditBeforeSave( $editPage, $text, &$resultArr ) {
104104 $spamObj = wfSpamBlacklistObject();
105105 $title = $editPage->mArticle->getTitle();
106106 $ret = $spamObj->filter( $title, $text, '', '', $editPage );
Index: trunk/extensions/TodoTasks/SpecialTaskList_body.php
@@ -198,14 +198,14 @@
199199 return true;
200200 }
201201
202 -function todoPreviewAction(&$q) {
 202+function todoPreviewAction($q) {
203203 global $todoPreview;
204204
205205 $todoPreview = $q;
206206 return true;
207207 }
208208
209 -function todoSavePreparser(&$q) {
 209+function todoSavePreparser($q) {
210210 // update the text of the todo so that it has a propper full name in it.
211211 // this way, the <dpl> search will work better
212212 $newpagetext = '';
Index: trunk/extensions/AssertEdit/AssertEdit.php
@@ -70,7 +70,7 @@
7171 return false;
7272 }
7373 }
74 -function efAssertApiEditHook( &$editPage, $textBox, &$result ) {
 74+function efAssertApiEditHook( $editPage, $textBox, &$result ) {
7575 global $wgOut, $wgRequest;
7676
7777 $assertName = $wgRequest->getVal( 'assert' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r55506Follow-up r55449: update efAssertEditHook() accordinglyialex21:45, 22 August 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r537145.3 reference error fixaaron12:08, 24 July 2009

Status & tagging log