r77640 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77639‎ | r77640 | r77641 >
Date:11:29, 3 December 2010
Author:ialex
Status:ok
Tags:
Comment:
Allow the submit callback function to return a Status object (will use this later for other forms)
Modified paths:
  • /trunk/phase3/includes/HTMLForm.php (modified) (history)
  • /trunk/phase3/includes/Preferences.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/HTMLForm.php
@@ -209,7 +209,9 @@
210210 $result = $this->trySubmit();
211211 }
212212
213 - if ( $result === true ) {
 213+ if ( $result === true ||
 214+ ( $result instanceof Status && $result->isGood() ) )
 215+ {
214216 return $result;
215217 }
216218
@@ -460,7 +462,10 @@
461463 * @return String
462464 */
463465 function getErrors( $errors ) {
464 - if ( is_array( $errors ) ) {
 466+ if ( $errors instanceof Status ) {
 467+ global $wgOut;
 468+ $errorstr = $wgOut->parse( $errors->getWikiText() );
 469+ } elseif ( is_array( $errors ) ) {
465470 $errorstr = $this->formatErrors( $errors );
466471 } else {
467472 $errorstr = $errors;
Index: trunk/phase3/includes/Preferences.php
@@ -1328,7 +1328,7 @@
13291329 $wgOut->redirect( $url );
13301330 }
13311331
1332 - return true;
 1332+ return Status::newGood();
13331333 }
13341334
13351335 public static function loadOldSearchNs( $user ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r81397Follow-up r77640: Check whether there are errors before asking Status to tran...btongminh15:44, 2 February 2011

Status & tagging log