Merge "Tweak CSSJanus to support noflip for selectors with parentheses"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 19 Jul 2013 19:01:12 +0000 (19:01 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 19 Jul 2013 19:01:12 +0000 (19:01 +0000)
RELEASE-NOTES-1.22
includes/DefaultSettings.php
includes/User.php
includes/actions/HistoryAction.php
includes/api/ApiQueryQueryPage.php
includes/api/ApiQueryUserInfo.php
includes/api/ApiQueryUsers.php

index 1766d9f..858a6f3 100644 (file)
@@ -204,6 +204,8 @@ production.
 * Handle relative inclusions ({{../name}}) in main namespace with subpages
   enabled correctly (previously MediaWiki tried to include Template:Parent/name
   instead of just Parent/name).
+* Added $wgAPIUselessQueryPages to allow extensions to flag their query pages
+  for non-inclusion in ApiQueryQueryPages.
 
 === API changes in 1.22 ===
 * (bug 25553) The JSON output formatter now leaves forward slashes unescaped
index 1f5b2f7..15f6987 100644 (file)
@@ -6034,6 +6034,16 @@ $wgAPIRequestLog = false;
  */
 $wgAPICacheHelpTimeout = 60 * 60;
 
+/**
+ * The ApiQueryQueryPages module should skip pages that are redundant to true
+ * API queries.
+ */
+$wgAPIUselessQueryPages = array(
+       'MIMEsearch', // aiprop=mime
+       'LinkSearch', // list=exturlusage
+       'FileDuplicateSearch', // prop=duplicatefiles
+);
+
 /**
  * Enable AJAX framework
  */
index 685bce7..30e618a 100644 (file)
@@ -2665,7 +2665,7 @@ class User {
 
        /**
         * Get the user's edit count.
-        * @return int
+        * @return int, null for anonymous users
         */
        public function getEditCount() {
                if ( !$this->getId() ) {
@@ -2687,10 +2687,10 @@ class User {
                                // it has not been initialized. do so.
                                $count = $this->initEditCount();
                        }
-                       $this->mEditCount = intval( $count );
+                       $this->mEditCount = $count;
                        wfProfileOut( __METHOD__ );
                }
-               return $this->mEditCount;
+               return (int) $this->mEditCount;
        }
 
        /**
index c07a311..6a1edd6 100644 (file)
@@ -372,9 +372,7 @@ class HistoryPager extends ReverseChronologicalPager {
                                array( 'rev_page' => $this->getWikiPage()->getId() ),
                                $this->conds ),
                        'options' => array( 'USE INDEX' => array( 'revision' => 'page_timestamp' ) ),
-                       'join_conds' => array(
-                               'user' => Revision::userJoinCond(),
-                               'tag_summary' => array( 'LEFT JOIN', 'ts_rev_id=rev_id' ) ),
+                       'join_conds' => array( 'user' => Revision::userJoinCond() ),
                );
                ChangeTags::modifyDisplayQuery(
                        $queryInfo['tables'],
index c15da1a..79fe049 100644 (file)
 class ApiQueryQueryPage extends ApiQueryGeneratorBase {
        private $qpMap;
 
-       /**
-        * Some query pages are useless because they're available elsewhere in the API
-        */
-       private $uselessQueryPages = array(
-               'MIMEsearch', // aiprop=mime
-               'LinkSearch', // list=exturlusage
-               'FileDuplicateSearch', // prop=duplicatefiles
-       );
-
        public function __construct( $query, $moduleName ) {
                parent::__construct( $query, $moduleName, 'qp' );
                // We need to do this to make sure $wgQueryPages is set up
@@ -49,10 +40,10 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase {
                require_once "$IP/includes/QueryPage.php";
 
                // Build mapping from special page names to QueryPage classes
-               global $wgQueryPages;
+               global $wgQueryPages, $wgAPIUselessQueryPages;
                $this->qpMap = array();
                foreach ( $wgQueryPages as $page ) {
-                       if ( !in_array( $page[1], $this->uselessQueryPages ) ) {
+                       if ( !in_array( $page[1], $wgAPIUselessQueryPages ) ) {
                                $this->qpMap[$page[1]] = $page[0];
                        }
                }
index 2b7e7cc..3c85ea6 100644 (file)
@@ -111,6 +111,8 @@ class ApiQueryUserInfo extends ApiQueryBase {
                }
 
                if ( isset( $this->prop['editcount'] ) ) {
+                       // use intval to prevent null if a non-logged-in user calls
+                       // api.php?format=jsonfm&action=query&meta=userinfo&uiprop=editcount
                        $vals['editcount'] = intval( $user->getEditCount() );
                }
 
index aec57a0..dccfee6 100644 (file)
@@ -149,7 +149,7 @@ class ApiQueryUsers extends ApiQueryBase {
                                $data[$name]['name'] = $name;
 
                                if ( isset( $this->prop['editcount'] ) ) {
-                                       $data[$name]['editcount'] = intval( $user->getEditCount() );
+                                       $data[$name]['editcount'] = $user->getEditCount();
                                }
 
                                if ( isset( $this->prop['registration'] ) ) {