ApiParse: Forbid section=new when using page, pageid, or oldid
authorDerk-Jan Hartman <hartman.wiki@gmail.com>
Wed, 25 Mar 2015 23:55:16 +0000 (00:55 +0100)
committerTheDJ <hartman.wiki@gmail.com>
Wed, 25 Mar 2015 23:58:04 +0000 (23:58 +0000)
Change-Id: I45ce0fe2083587e429143aa3d8d832aa884e1ad7

includes/api/ApiParse.php

index 20592ca..b621861 100644 (file)
@@ -88,6 +88,9 @@ class ApiParse extends ApiBase {
                $result = $this->getResult();
 
                if ( !is_null( $oldid ) || !is_null( $pageid ) || !is_null( $page ) ) {
+                       if ( $this->section === 'new' ) {
+                                       $this->dieUsage( 'section=new cannot be combined with oldid, pageid or page parameters. Please use text', 'params' );
+                       }
                        if ( !is_null( $oldid ) ) {
                                // Don't use the parser cache
                                $rev = Revision::newFromId( $oldid );