Merge "Avoid races on null revision insertion"
[lhc/web/wiklou.git] / includes / api / ApiParse.php
index cce8572..5754c23 100644 (file)
@@ -427,9 +427,6 @@ class ApiParse extends ApiBase {
                }
 
                if ( isset( $prop['parsetree'] ) || $params['generatexml'] ) {
-                       if ( !isset( $prop['parsetree'] ) ) {
-                               $this->logFeatureUsage( 'action=parse&generatexml' );
-                       }
                        if ( $this->content->getModel() != CONTENT_MODEL_WIKITEXT ) {
                                $this->dieUsage( "parsetree is only supported for wikitext content", "notwikitext" );
                        }
@@ -526,7 +523,7 @@ class ApiParse extends ApiBase {
         * @return Content
         */
        private function getContent( WikiPage $page, $pageId = null ) {
-               $content = $page->getContent( Revision::RAW ); //XXX: really raw?
+               $content = $page->getContent( Revision::RAW ); // XXX: really raw?
 
                if ( $this->section !== false && $content !== null ) {
                        $content = $this->getSectionContent(
@@ -637,7 +634,8 @@ class ApiParse extends ApiBase {
                foreach ( $links as $link => $sortkey ) {
                        $entry = array();
                        $entry['sortkey'] = $sortkey;
-                       ApiResult::setContentValue( $entry, 'category', $link );
+                       // array keys will cast numeric category names to ints, so cast back to string
+                       ApiResult::setContentValue( $entry, 'category', (string)$link );
                        if ( !isset( $hiddencats[$link] ) ) {
                                $entry['missing'] = true;
                        } elseif ( $hiddencats[$link] ) {
@@ -717,7 +715,6 @@ class ApiParse extends ApiBase {
 
        private function formatLimitReportData( $limitReportData ) {
                $result = array();
-               $apiResult = $this->getResult();
 
                foreach ( $limitReportData as $name => $value ) {
                        $entry = array();