Used DIRECTORY_SEPARATOR instead of '/' in GitInfo.php
[lhc/web/wiklou.git] / includes / api / ApiQueryAllPages.php
index d95980c..501154a 100644 (file)
@@ -49,7 +49,11 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
         */
        public function executeGenerator( $resultPageSet ) {
                if ( $resultPageSet->isResolvingRedirects() ) {
-                       $this->dieUsage( 'Use "gapfilterredir=nonredirects" option instead of "redirects" when using allpages as a generator', 'params' );
+                       $this->dieUsage(
+                               'Use "gapfilterredir=nonredirects" option instead of "redirects" ' .
+                                       'when using allpages as a generator',
+                               'params'
+                       );
                }
 
                $this->run( $resultPageSet );
@@ -83,12 +87,18 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
 
                $this->addWhereFld( 'page_namespace', $params['namespace'] );
                $dir = ( $params['dir'] == 'descending' ? 'older' : 'newer' );
-               $from = ( is_null( $params['from'] ) ? null : $this->titlePartToKey( $params['from'] ) );
-               $to = ( is_null( $params['to'] ) ? null : $this->titlePartToKey( $params['to'] ) );
+               $from = ( $params['from'] === null
+                       ? null
+                       : $this->titlePartToKey( $params['from'], $params['namespace'] ) );
+               $to = ( $params['to'] === null
+                       ? null
+                       : $this->titlePartToKey( $params['to'], $params['namespace'] ) );
                $this->addWhereRange( 'page_title', $dir, $from, $to );
 
                if ( isset( $params['prefix'] ) ) {
-                       $this->addWhere( 'page_title' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
+                       $this->addWhere( 'page_title' . $db->buildLike(
+                               $this->titlePartToKey( $params['prefix'], $params['namespace'] ),
+                               $db->anyString() ) );
                }
 
                if ( is_null( $resultPageSet ) ) {
@@ -145,7 +155,6 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
                        }
 
                        $this->addOption( 'DISTINCT' );
-
                } elseif ( isset( $params['prlevel'] ) ) {
                        $this->dieUsage( 'prlevel may not be used without prtype', 'params' );
                }
@@ -186,8 +195,9 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
                $count = 0;
                $result = $this->getResult();
                foreach ( $res as $row ) {
-                       if ( ++ $count > $limit ) {
-                               // We've reached the one extra which shows that there are additional pages to be had. Stop here...
+                       if ( ++$count > $limit ) {
+                               // We've reached the one extra which shows that there are
+                               // additional pages to be had. Stop here...
                                $this->setContinueEnumParameter( 'continue', $row->page_title );
                                break;
                        }
@@ -291,6 +301,7 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
 
        public function getParamDescription() {
                $p = $this->getModulePrefix();
+
                return array(
                        'from' => 'The page title to start enumerating from',
                        'continue' => 'When more results are available, use this to continue',
@@ -303,7 +314,8 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
                        'maxsize' => 'Limit to pages with at most this many bytes',
                        'prtype' => 'Limit to protected pages only',
                        'prlevel' => "The protection level (must be used with {$p}prtype= parameter)",
-                       'prfiltercascade' => "Filter protections based on cascadingness (ignored when {$p}prtype isn't set)",
+                       'prfiltercascade'
+                               => "Filter protections based on cascadingness (ignored when {$p}prtype isn't set)",
                        'filterlanglinks' => array(
                                'Filter based on whether a page has langlinks',
                                'Note that this may not consider langlinks added by extensions.',
@@ -334,7 +346,11 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
 
        public function getPossibleErrors() {
                return array_merge( parent::getPossibleErrors(), array(
-                       array( 'code' => 'params', 'info' => 'Use "gapfilterredir=nonredirects" option instead of "redirects" when using allpages as a generator' ),
+                       array(
+                               'code' => 'params',
+                               'info' => 'Use "gapfilterredir=nonredirects" option instead of ' .
+                                       '"redirects" when using allpages as a generator'
+                       ),
                        array( 'code' => 'params', 'info' => 'prlevel may not be used without prtype' ),
                ) );
        }
@@ -349,9 +365,9 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
                                'Using as Generator',
                                'Show info about 4 pages starting at the letter "T"',
                        ),
-                       'api.php?action=query&generator=allpages&gaplimit=2&gapfilterredir=nonredirects&gapfrom=Re&prop=revisions&rvprop=content' => array(
-                               'Show content of first 2 non-redirect pages beginning at "Re"',
-                       )
+                       'api.php?action=query&generator=allpages&gaplimit=2&' .
+                               'gapfilterredir=nonredirects&gapfrom=Re&prop=revisions&rvprop=content'
+                               => array( 'Show content of first 2 non-redirect pages beginning at "Re"' )
                );
        }