r103471 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103470‎ | r103471 | r103472 >
Date:16:00, 17 November 2011
Author:mah
Status:resolved (Comments)
Tags:
Comment:
Apply cryptocoryne's patch from Bug 32454 - ArticlePurge hook is broken after r86041
Modified paths:
  • /trunk/phase3/CREDITS (modified) (history)
  • /trunk/phase3/includes/WikiPage.php (modified) (history)
  • /trunk/phase3/includes/actions/PurgeAction.php (modified) (history)

Diff [purge]

Index: trunk/phase3/CREDITS
@@ -91,6 +91,7 @@
9292 * Carlin
9393 * Carsten Nielsen
9494 * Conrad Irwin
 95+* cryptocoryne
9596 * Dan Barrett
9697 * Dan Collins
9798 * Dan Nessett
Index: trunk/phase3/includes/actions/PurgeAction.php
@@ -52,8 +52,7 @@
5353 }
5454
5555 public function onSubmit( $data ) {
56 - $this->page->doPurge();
57 - return true;
 56+ return $this->page->doPurge();
5857 }
5958
6059 /**
@@ -71,8 +70,9 @@
7271 $this->getRequest()->getQueryValues(),
7372 array( 'title' => null, 'action' => null )
7473 ) );
75 - $this->onSubmit( array() );
76 - $this->onSuccess();
 74+ if( $this->onSubmit( array() ) ) {
 75+ $this->onSuccess();
 76+ }
7777 } else {
7878 $this->redirectParams = $this->getRequest()->getVal( 'redirectparams', '' );
7979 $form = $this->getForm();
Index: trunk/phase3/includes/WikiPage.php
@@ -755,6 +755,7 @@
756756
757757 MessageCache::singleton()->replace( $this->mTitle->getDBkey(), $text );
758758 }
 759+ return true;
759760 }
760761
761762 /**

Sign-offs

UserFlagDate
Bawolfftested20:46, 17 November 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r105269Fix for r103471: WikiPage::doSubmit() is not the only implementation of doSub...tstarling01:21, 6 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r86041r86001, now with less scariness :P I took out the delete action and did purg...happy-melon10:38, 14 April 2011

Comments

#Comment by Bawolff (talk | contribs)   20:45, 17 November 2011

One thing I'm not sure about - is it appropriate to return false for fail from onSubmit? The docs for that method say:

@return Bool|Array true for success, false for didn't-try, array of errors on failure

I'm not sure if hook arborted should be error instead of "didn't try".

As a note, in my testing, things are still slightly different because something like (stolen from bug report):

$wgHooks['ArticlePurge'][] = 'testArticlePurge';
 function testArticlePurge( &$article ) {
    global $wgOut;
    $wgOut->addWikiMsg( 'error' );
    return false;
}

Would present an error page with no page title (in the

) in 1.17, but now would use the page's title in the

. However, I don't think that's something to really care about.

#Comment by Bawolff (talk | contribs)   20:46, 17 November 2011

I swear I escaped that with entities. Try 2:


One thing I'm not sure about - is it appropriate to return false for fail from onSubmit? The docs for that method say:

@return Bool|Array true for success, false for didn't-try, array of errors on failure

I'm not sure if hook arborted should be error instead of "didn't try".

As a note, in my testing, things are still slightly different because something like (stolen from bug report):

$wgHooks['ArticlePurge'][] = 'testArticlePurge';

function testArticlePurge( &$article ) {
   global $wgOut;
   $wgOut->addWikiMsg( 'error' );
   return false;

}

Would present an error page with no page title (in the < h1 >) in 1.17, but now would use the page's title in the < h1 > . However, I don't think that's something to really care about.

Status & tagging log