r68636 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68635‎ | r68636 | r68637 >
Date:19:22, 27 June 2010
Author:reedy
Status:ok (Comments)
Tags:
Comment:
* (bug 24136) unknownerror when adding new section without summary, but forceditsummary

Handle AS_SUMMARY_NEEDED in ApiEditPage

Fixup some braces
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiBase.php (modified) (history)
  • /trunk/phase3/includes/api/ApiEditPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiEditPage.php
@@ -117,16 +117,14 @@
118118 $undoafterRev = Revision::newFromID( $params['undoafter'] );
119119 }
120120 $undoRev = Revision::newFromID( $params['undo'] );
121 - if ( is_null( $undoRev ) || $undoRev->isDeleted( Revision::DELETED_TEXT ) )
122 - {
 121+ if ( is_null( $undoRev ) || $undoRev->isDeleted( Revision::DELETED_TEXT ) ) {
123122 $this->dieUsageMsg( array( 'nosuchrevid', $params['undo'] ) );
124123 }
125124
126125 if ( $params['undoafter'] == 0 ) {
127126 $undoafterRev = $undoRev->getPrevious();
128127 }
129 - if ( is_null( $undoafterRev ) || $undoafterRev->isDeleted( Revision::DELETED_TEXT ) )
130 - {
 128+ if ( is_null( $undoafterRev ) || $undoafterRev->isDeleted( Revision::DELETED_TEXT ) ) {
131129 $this->dieUsageMsg( array( 'nosuchrevid', $params['undoafter'] ) );
132130 }
133131
@@ -144,8 +142,7 @@
145143 $params['text'] = $newtext;
146144 // If no summary was given and we only undid one rev,
147145 // use an autosummary
148 - if ( is_null( $params['summary'] ) && $titleObj->getNextRevisionID( $undoafterRev->getID() ) == $params['undo'] )
149 - {
 146+ if ( is_null( $params['summary'] ) && $titleObj->getNextRevisionID( $undoafterRev->getID() ) == $params['undo'] ) {
150147 $params['summary'] = wfMsgForContent( 'undo-summary', $params['undo'], $undoRev->getUserText() );
151148 }
152149 }
@@ -170,8 +167,7 @@
171168
172169 // Watch out for basetimestamp == ''
173170 // wfTimestamp() treats it as NOW, almost certainly causing an edit conflict
174 - if ( !is_null( $params['basetimestamp'] ) && $params['basetimestamp'] != '' )
175 - {
 171+ if ( !is_null( $params['basetimestamp'] ) && $params['basetimestamp'] != '' ) {
176172 $reqArr['wpEdittime'] = wfTimestamp( TS_MW, $params['basetimestamp'] );
177173 } else {
178174 $reqArr['wpEdittime'] = $articleObj->getTimestamp();
@@ -193,8 +189,7 @@
194190
195191 if ( !is_null( $params['section'] ) ) {
196192 $section = intval( $params['section'] );
197 - if ( $section == 0 && $params['section'] != '0' && $params['section'] != 'new' )
198 - {
 193+ if ( $section == 0 && $params['section'] != '0' && $params['section'] != 'new' ) {
199194 $this->dieUsage( "The section parameter must be set to an integer or 'new'", "invalidsection" );
200195 }
201196 $reqArr['wpSection'] = $params['section'];
@@ -229,8 +224,7 @@
230225 }
231226
232227 $r = array();
233 - if ( !wfRunHooks( 'APIEditBeforeSave', array( $ep, $ep->textbox1, &$r ) ) )
234 - {
 228+ if ( !wfRunHooks( 'APIEditBeforeSave', array( $ep, $ep->textbox1, &$r ) ) ) {
235229 if ( count( $r ) ) {
236230 $r['result'] = 'Failure';
237231 $this->getResult()->addValue( null, $this->getModuleName(), $r );
@@ -324,6 +318,9 @@
325319 $newArticle->getTimestamp() );
326320 }
327321 break;
 322+
 323+ case EditPage::AS_SUMMARY_NEEDED:
 324+ $this->dieUsageMsg( array( 'summaryrequired' ) );
328325
329326 case EditPage::AS_END:
330327 // This usually means some kind of race condition
Index: trunk/phase3/includes/api/ApiBase.php
@@ -928,6 +928,7 @@
929929 'userrights-nodatabase' => array( 'code' => 'nosuchdatabase', 'info' => "Database ``\$1'' does not exist or is not local" ),
930930 'nouserspecified' => array( 'code' => 'invaliduser', 'info' => "Invalid username ``\$1''" ),
931931 'noname' => array( 'code' => 'invaliduser', 'info' => "Invalid username ``\$1''" ),
 932+ 'summaryrequired' => array( 'code' => 'summaryrequired', 'info' => 'Summary required'),
932933
933934 // API-specific messages
934935 'readrequired' => array( 'code' => 'readapidenied', 'info' => "You need read permission to use this module" ),
Index: trunk/phase3/RELEASE-NOTES
@@ -245,7 +245,8 @@
246246 * (bug 24016) API: Handle parameters specified in simple string syntax
247247 ( 'paramname' => 'defaultval' ) correctly when outputting help
248248 * (bug 24089) Logevents causes PHP Notice if leprop=title isn't supplied
249 -* (bug 23473) - Give description of properties on all modules
 249+* (bug 23473) Give description of properties on all modules
 250+* (bug 24136) unknownerror when adding new section without summary, but forceditsummary
250251
251252 === Languages updated in 1.17 ===
252253

Follow-up revisions

RevisionCommit summaryAuthorDate
r68643Minor followup to r68636, add to getPossibleErrorsreedy20:30, 27 June 2010

Comments

#Comment by Catrope (talk | contribs)   16:07, 28 June 2010

Could use a more descriptive error message IMO.

#Comment by Reedy (talk | contribs)   06:02, 29 June 2010

"Summary for this action required" ?

#Comment by Reedy (talk | contribs)   06:05, 29 June 2010

Or something more verbose that i'm obviously missing?

#Comment by Catrope (talk | contribs)   09:16, 29 June 2010

I was gonna say "Edit summary required" or something but then realized there are more kinds of summaries. I guess the message is fine as it is then.

Status & tagging log