Used DIRECTORY_SEPARATOR instead of '/' in GitInfo.php
[lhc/web/wiklou.git] / includes / api / ApiQueryAllLinks.php
index 47d1bce..bccc25f 100644 (file)
@@ -54,7 +54,8 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
                                $this->dfltNamespace = NS_TEMPLATE;
                                $this->hasNamespace = true;
                                $this->indexTag = 't';
-                               $this->description = 'List all transclusions (pages embedded using {{x}}), including non-existing';
+                               $this->description =
+                                       'List all transclusions (pages embedded using {{x}}), including non-existing';
                                $this->descriptionWhat = 'transclusion';
                                $this->descriptionTargets = 'transcluded titles';
                                $this->descriptionLinking = 'transcluding';
@@ -113,8 +114,10 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
                if ( $params['unique'] ) {
                        if ( $fld_ids ) {
                                $this->dieUsage(
-                                       "{$this->getModuleName()} cannot return corresponding page ids in unique {$this->descriptionWhat}s mode",
-                                       'params' );
+                                       "{$this->getModuleName()} cannot return corresponding page " .
+                                               "ids in unique {$this->descriptionWhat}s mode",
+                                       'params'
+                               );
                        }
                        $this->addOption( 'DISTINCT' );
                }
@@ -145,12 +148,15 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
                }
 
                // 'continue' always overrides 'from'
-               $from = ( $continue || is_null( $params['from'] ) ? null : $this->titlePartToKey( $params['from'] ) );
-               $to = ( is_null( $params['to'] ) ? null : $this->titlePartToKey( $params['to'] ) );
+               $from = ( $continue || $params['from'] === null ? null :
+                       $this->titlePartToKey( $params['from'], $namespace ) );
+               $to = ( $params['to'] === null ? null :
+                       $this->titlePartToKey( $params['to'], $namespace ) );
                $this->addWhereRange( $pfx . $fieldTitle, 'newer', $from, $to );
 
                if ( isset( $params['prefix'] ) ) {
-                       $this->addWhere( $pfx . $fieldTitle . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
+                       $this->addWhere( $pfx . $fieldTitle . $db->buildLike( $this->titlePartToKey(
+                               $params['prefix'], $namespace ), $db->anyString() ) );
                }
 
                $this->addFields( array( 'pl_title' => $pfx . $fieldTitle ) );
@@ -177,8 +183,9 @@ class ApiQueryAllLinks 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...
                                if ( $params['unique'] ) {
                                        $this->setContinueEnumParameter( 'continue', $row->pl_title );
                                } else {
@@ -258,6 +265,7 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
                if ( !$this->hasNamespace ) {
                        unset( $allowedParams['namespace'] );
                }
+
                return $allowedParams;
        }
 
@@ -287,6 +295,7 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
                if ( !$this->hasNamespace ) {
                        unset( $paramDescription['namespace'] );
                }
+
                return $paramDescription;
        }
 
@@ -309,8 +318,12 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
        public function getPossibleErrors() {
                $m = $this->getModuleName();
                $what = $this->descriptionWhat;
+
                return array_merge( parent::getPossibleErrors(), array(
-                       array( 'code' => 'params', 'info' => "{$m} cannot return corresponding page ids in unique {$what}s mode" ),
+                       array(
+                               'code' => 'params',
+                               'info' => "{$m} cannot return corresponding page ids in unique {$what}s mode"
+                       ),
                ) );
        }
 
@@ -319,20 +332,22 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
                $name = $this->getModuleName();
                $what = $this->descriptionWhat;
                $targets = $this->descriptionTargets;
+
                return array(
                        "api.php?action=query&list={$name}&{$p}from=B&{$p}prop=ids|title"
-                                       => "List $targets with page ids they are from, including missing ones. Start at B",
+                               => "List $targets with page ids they are from, including missing ones. Start at B",
                        "api.php?action=query&list={$name}&{$p}unique=&{$p}from=B"
-                                       => "List unique $targets",
+                               => "List unique $targets",
                        "api.php?action=query&generator={$name}&g{$p}unique=&g{$p}from=B"
-                                       => "Gets all $targets, marking the missing ones",
+                               => "Gets all $targets, marking the missing ones",
                        "api.php?action=query&generator={$name}&g{$p}from=B"
-                                       => "Gets pages containing the {$what}s",
+                               => "Gets pages containing the {$what}s",
                );
        }
 
        public function getHelpUrls() {
                $name = ucfirst( $this->getModuleName() );
+
                return "https://www.mediawiki.org/wiki/API:{$name}";
        }
 }