Index: trunk/phase3/includes/api/ApiEditPage.php |
— | — | @@ -117,16 +117,14 @@ |
118 | 118 | $undoafterRev = Revision::newFromID( $params['undoafter'] ); |
119 | 119 | } |
120 | 120 | $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 ) ) { |
123 | 122 | $this->dieUsageMsg( array( 'nosuchrevid', $params['undo'] ) ); |
124 | 123 | } |
125 | 124 | |
126 | 125 | if ( $params['undoafter'] == 0 ) { |
127 | 126 | $undoafterRev = $undoRev->getPrevious(); |
128 | 127 | } |
129 | | - if ( is_null( $undoafterRev ) || $undoafterRev->isDeleted( Revision::DELETED_TEXT ) ) |
130 | | - { |
| 128 | + if ( is_null( $undoafterRev ) || $undoafterRev->isDeleted( Revision::DELETED_TEXT ) ) { |
131 | 129 | $this->dieUsageMsg( array( 'nosuchrevid', $params['undoafter'] ) ); |
132 | 130 | } |
133 | 131 | |
— | — | @@ -144,8 +142,7 @@ |
145 | 143 | $params['text'] = $newtext; |
146 | 144 | // If no summary was given and we only undid one rev, |
147 | 145 | // 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'] ) { |
150 | 147 | $params['summary'] = wfMsgForContent( 'undo-summary', $params['undo'], $undoRev->getUserText() ); |
151 | 148 | } |
152 | 149 | } |
— | — | @@ -170,8 +167,7 @@ |
171 | 168 | |
172 | 169 | // Watch out for basetimestamp == '' |
173 | 170 | // 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'] != '' ) { |
176 | 172 | $reqArr['wpEdittime'] = wfTimestamp( TS_MW, $params['basetimestamp'] ); |
177 | 173 | } else { |
178 | 174 | $reqArr['wpEdittime'] = $articleObj->getTimestamp(); |
— | — | @@ -193,8 +189,7 @@ |
194 | 190 | |
195 | 191 | if ( !is_null( $params['section'] ) ) { |
196 | 192 | $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' ) { |
199 | 194 | $this->dieUsage( "The section parameter must be set to an integer or 'new'", "invalidsection" ); |
200 | 195 | } |
201 | 196 | $reqArr['wpSection'] = $params['section']; |
— | — | @@ -229,8 +224,7 @@ |
230 | 225 | } |
231 | 226 | |
232 | 227 | $r = array(); |
233 | | - if ( !wfRunHooks( 'APIEditBeforeSave', array( $ep, $ep->textbox1, &$r ) ) ) |
234 | | - { |
| 228 | + if ( !wfRunHooks( 'APIEditBeforeSave', array( $ep, $ep->textbox1, &$r ) ) ) { |
235 | 229 | if ( count( $r ) ) { |
236 | 230 | $r['result'] = 'Failure'; |
237 | 231 | $this->getResult()->addValue( null, $this->getModuleName(), $r ); |
— | — | @@ -324,6 +318,9 @@ |
325 | 319 | $newArticle->getTimestamp() ); |
326 | 320 | } |
327 | 321 | break; |
| 322 | + |
| 323 | + case EditPage::AS_SUMMARY_NEEDED: |
| 324 | + $this->dieUsageMsg( array( 'summaryrequired' ) ); |
328 | 325 | |
329 | 326 | case EditPage::AS_END: |
330 | 327 | // This usually means some kind of race condition |
Index: trunk/phase3/includes/api/ApiBase.php |
— | — | @@ -928,6 +928,7 @@ |
929 | 929 | 'userrights-nodatabase' => array( 'code' => 'nosuchdatabase', 'info' => "Database ``\$1'' does not exist or is not local" ), |
930 | 930 | 'nouserspecified' => array( 'code' => 'invaliduser', 'info' => "Invalid username ``\$1''" ), |
931 | 931 | 'noname' => array( 'code' => 'invaliduser', 'info' => "Invalid username ``\$1''" ), |
| 932 | + 'summaryrequired' => array( 'code' => 'summaryrequired', 'info' => 'Summary required'), |
932 | 933 | |
933 | 934 | // API-specific messages |
934 | 935 | 'readrequired' => array( 'code' => 'readapidenied', 'info' => "You need read permission to use this module" ), |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -245,7 +245,8 @@ |
246 | 246 | * (bug 24016) API: Handle parameters specified in simple string syntax |
247 | 247 | ( 'paramname' => 'defaultval' ) correctly when outputting help |
248 | 248 | * (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 |
250 | 251 | |
251 | 252 | === Languages updated in 1.17 === |
252 | 253 | |