* (bug 24136) unknownerror when adding new section without summary, but forceditsummary
Handle AS_SUMMARY_NEEDED in ApiEditPage Fixup some braces
This commit is contained in:
parent
0402cedf0f
commit
3fe7b6912b
3 changed files with 12 additions and 13 deletions
|
|
@ -245,7 +245,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
|
|||
* (bug 24016) API: Handle parameters specified in simple string syntax
|
||||
( 'paramname' => 'defaultval' ) correctly when outputting help
|
||||
* (bug 24089) Logevents causes PHP Notice if leprop=title isn't supplied
|
||||
* (bug 23473) - Give description of properties on all modules
|
||||
* (bug 23473) Give description of properties on all modules
|
||||
* (bug 24136) unknownerror when adding new section without summary, but forceditsummary
|
||||
|
||||
=== Languages updated in 1.17 ===
|
||||
|
||||
|
|
|
|||
|
|
@ -928,6 +928,7 @@ abstract class ApiBase {
|
|||
'userrights-nodatabase' => array( 'code' => 'nosuchdatabase', 'info' => "Database ``\$1'' does not exist or is not local" ),
|
||||
'nouserspecified' => array( 'code' => 'invaliduser', 'info' => "Invalid username ``\$1''" ),
|
||||
'noname' => array( 'code' => 'invaliduser', 'info' => "Invalid username ``\$1''" ),
|
||||
'summaryrequired' => array( 'code' => 'summaryrequired', 'info' => 'Summary required'),
|
||||
|
||||
// API-specific messages
|
||||
'readrequired' => array( 'code' => 'readapidenied', 'info' => "You need read permission to use this module" ),
|
||||
|
|
|
|||
|
|
@ -117,16 +117,14 @@ class ApiEditPage extends ApiBase {
|
|||
$undoafterRev = Revision::newFromID( $params['undoafter'] );
|
||||
}
|
||||
$undoRev = Revision::newFromID( $params['undo'] );
|
||||
if ( is_null( $undoRev ) || $undoRev->isDeleted( Revision::DELETED_TEXT ) )
|
||||
{
|
||||
if ( is_null( $undoRev ) || $undoRev->isDeleted( Revision::DELETED_TEXT ) ) {
|
||||
$this->dieUsageMsg( array( 'nosuchrevid', $params['undo'] ) );
|
||||
}
|
||||
|
||||
if ( $params['undoafter'] == 0 ) {
|
||||
$undoafterRev = $undoRev->getPrevious();
|
||||
}
|
||||
if ( is_null( $undoafterRev ) || $undoafterRev->isDeleted( Revision::DELETED_TEXT ) )
|
||||
{
|
||||
if ( is_null( $undoafterRev ) || $undoafterRev->isDeleted( Revision::DELETED_TEXT ) ) {
|
||||
$this->dieUsageMsg( array( 'nosuchrevid', $params['undoafter'] ) );
|
||||
}
|
||||
|
||||
|
|
@ -144,8 +142,7 @@ class ApiEditPage extends ApiBase {
|
|||
$params['text'] = $newtext;
|
||||
// If no summary was given and we only undid one rev,
|
||||
// use an autosummary
|
||||
if ( is_null( $params['summary'] ) && $titleObj->getNextRevisionID( $undoafterRev->getID() ) == $params['undo'] )
|
||||
{
|
||||
if ( is_null( $params['summary'] ) && $titleObj->getNextRevisionID( $undoafterRev->getID() ) == $params['undo'] ) {
|
||||
$params['summary'] = wfMsgForContent( 'undo-summary', $params['undo'], $undoRev->getUserText() );
|
||||
}
|
||||
}
|
||||
|
|
@ -170,8 +167,7 @@ class ApiEditPage extends ApiBase {
|
|||
|
||||
// Watch out for basetimestamp == ''
|
||||
// wfTimestamp() treats it as NOW, almost certainly causing an edit conflict
|
||||
if ( !is_null( $params['basetimestamp'] ) && $params['basetimestamp'] != '' )
|
||||
{
|
||||
if ( !is_null( $params['basetimestamp'] ) && $params['basetimestamp'] != '' ) {
|
||||
$reqArr['wpEdittime'] = wfTimestamp( TS_MW, $params['basetimestamp'] );
|
||||
} else {
|
||||
$reqArr['wpEdittime'] = $articleObj->getTimestamp();
|
||||
|
|
@ -193,8 +189,7 @@ class ApiEditPage extends ApiBase {
|
|||
|
||||
if ( !is_null( $params['section'] ) ) {
|
||||
$section = intval( $params['section'] );
|
||||
if ( $section == 0 && $params['section'] != '0' && $params['section'] != 'new' )
|
||||
{
|
||||
if ( $section == 0 && $params['section'] != '0' && $params['section'] != 'new' ) {
|
||||
$this->dieUsage( "The section parameter must be set to an integer or 'new'", "invalidsection" );
|
||||
}
|
||||
$reqArr['wpSection'] = $params['section'];
|
||||
|
|
@ -229,8 +224,7 @@ class ApiEditPage extends ApiBase {
|
|||
}
|
||||
|
||||
$r = array();
|
||||
if ( !wfRunHooks( 'APIEditBeforeSave', array( $ep, $ep->textbox1, &$r ) ) )
|
||||
{
|
||||
if ( !wfRunHooks( 'APIEditBeforeSave', array( $ep, $ep->textbox1, &$r ) ) ) {
|
||||
if ( count( $r ) ) {
|
||||
$r['result'] = 'Failure';
|
||||
$this->getResult()->addValue( null, $this->getModuleName(), $r );
|
||||
|
|
@ -324,6 +318,9 @@ class ApiEditPage extends ApiBase {
|
|||
$newArticle->getTimestamp() );
|
||||
}
|
||||
break;
|
||||
|
||||
case EditPage::AS_SUMMARY_NEEDED:
|
||||
$this->dieUsageMsg( array( 'summaryrequired' ) );
|
||||
|
||||
case EditPage::AS_END:
|
||||
// This usually means some kind of race condition
|
||||
|
|
|
|||
Loading…
Reference in a new issue