Merge "Add function to clear mPreparedEdit, to use in cases of mutable content"
[lhc/web/wiklou.git] / includes / api / ApiQueryPageProps.php
index a253c88..e51c7ab 100644 (file)
@@ -49,7 +49,7 @@ class ApiQueryPageProps extends ApiQueryBase {
 
                $this->addTables( 'page_props' );
                $this->addFields( array( 'pp_page', 'pp_propname', 'pp_value' ) );
-               $this->addWhereFld( 'pp_page',  array_keys( $pages ) );
+               $this->addWhereFld( 'pp_page', array_keys( $pages ) );
 
                if ( $this->params['continue'] ) {
                        $this->addWhere( 'pp_page >=' . intval( $this->params['continue'] ) );
@@ -60,7 +60,10 @@ class ApiQueryPageProps extends ApiQueryBase {
                }
 
                # Force a sort order to ensure that properties are grouped by page
-               $this->addOption( 'ORDER BY', 'pp_page' );
+               # But only if pp_page is not constant in the WHERE clause.
+               if ( count( $pages ) > 1 ) {
+                       $this->addOption( 'ORDER BY', 'pp_page' );
+               }
 
                $res = $this->select( __METHOD__ );
                $currentPage = 0; # Id of the page currently processed
@@ -112,6 +115,7 @@ class ApiQueryPageProps extends ApiQueryBase {
                if ( !$fit ) {
                        $this->setContinueEnumParameter( 'continue', $page );
                }
+
                return $fit;
        }
 
@@ -122,14 +126,17 @@ class ApiQueryPageProps extends ApiQueryBase {
        public function getAllowedParams() {
                return array(
                        'continue' => null,
-                       'prop' => null,
+                       'prop' => array(
+                               ApiBase::PARAM_ISMULTI => true,
+                       ),
                );
        }
 
        public function getParamDescription() {
                return array(
                        'continue' => 'When more results are available, use this to continue',
-                       'prop' => 'Page prop to look on the page for. Useful for checking whether a certain page uses a certain page prop.'
+                       'prop' => 'Only list these props. Useful for checking whether a ' .
+                               'certain page uses a certain page prop',
                );
        }
 
@@ -144,10 +151,6 @@ class ApiQueryPageProps extends ApiQueryBase {
        }
 
        public function getHelpUrls() {
-               return 'http://www.mediawiki.org/wiki/API:Properties#pageprops_.2F_pp';
-       }
-
-       public function getVersion() {
-               return __CLASS__ . ': $Id$';
+               return 'https://www.mediawiki.org/wiki/API:Properties#pageprops_.2F_pp';
        }
 }