J has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/52223


Change subject: Add option to pass defaultNamespace to ApiPageSet
......................................................................

Add option to pass defaultNamespace to ApiPageSet

Change-Id: I47f0ce18fcb877ae88e5eb26eef4c1c74a6d6755
---
M includes/api/ApiPageSet.php
1 file changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/23/52223/1

diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php
index 1bb7e47..c6ffc8d 100644
--- a/includes/api/ApiPageSet.php
+++ b/includes/api/ApiPageSet.php
@@ -69,6 +69,7 @@
        private $mFakePageId = -1;
        private $mCacheMode = 'public';
        private $mRequestedPageFields = array();
+       private $mDefaultNamespace = NS_MAIN;
 
        /**
         * Constructor
@@ -77,10 +78,11 @@
         * @param $flags int Zero or more flags like DISABLE_GENERATORS
         * @since 1.21 accepts $flags instead of two boolean values
         */
-       public function __construct( ApiBase $dbSource, $flags = 0 ) {
+       public function __construct( ApiBase $dbSource, $flags = 0, 
$defaultNamespace = NS_MAIN ) {
                parent::__construct( $dbSource->getMain(), 
$dbSource->getModuleName() );
                $this->mDbSource = $dbSource;
                $this->mAllowGenerator = ( $flags & 
ApiPageSet::DISABLE_GENERATORS ) == 0;
+               $this->mDefaultNamespace = $defaultNamespace;
 
                $this->profileIn();
                $this->mParams = $this->extractRequestParams();
@@ -885,11 +887,11 @@
        private function processTitlesArray( $titles ) {
                $genderCache = GenderCache::singleton();
                $genderCache->doTitlesArray( $titles, __METHOD__ );
-
                $linkBatch = new LinkBatch();
 
                foreach ( $titles as $title ) {
-                       $titleObj = is_string( $title ) ? Title::newFromText( 
$title ) : $title;
+                       $titleObj = is_string( $title ) ? Title::newFromText(
+                               $title, $defaultNamespace = 
$this->mDefaultNamespace ) : $title;
                        if ( !$titleObj ) {
                                // Handle invalid titles gracefully
                                $this->mAllpages[0][$title] = 
$this->mFakePageId;

-- 
To view, visit https://gerrit.wikimedia.org/r/52223
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I47f0ce18fcb877ae88e5eb26eef4c1c74a6d6755
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: J <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to