From 1ff24603a9e8730d8e947dcf53a6ab03e92b285b Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Fri, 13 Feb 2009 15:14:21 +0000 Subject: [PATCH] API: Fix up r47214, which strangely had no commit message * Use + instead of array_merge(), the latter messes up keys * Fix a fatal error ($result not an object) * Fix an interesting mistake when calling addTables(): addTables('foo', 'bar') doesn't add both tables, but adds foo AS bar * Fix warning about $row->pt_namespace not being set Commit message for r47214: API: Refactor ApiQueryInfo * Move result generating code from execute() to extractPageInfo() ** Merge code for existing and missing titles * Don't loop over existing and missing titles separately, but on both in one go * Move protection query code from execute() to getProtectionInfo() ** Merge code for existing and missing titles here as well * Move subjectid/talkid query code from execute() to getTSIDs() * Document some functions --- includes/api/ApiQueryInfo.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index 86a6af71a6..ce5d2ac97b 100644 --- a/includes/api/ApiQueryInfo.php +++ b/includes/api/ApiQueryInfo.php @@ -204,7 +204,7 @@ class ApiQueryInfo extends ApiQueryBase { $pageSet = $this->getPageSet(); $this->titles = $pageSet->getGoodTitles(); $this->missing = $pageSet->getMissingTitles(); - $this->everything = array_merge($this->titles, $this->missing); + $this->everything = $this->titles + $this->missing; $result = $this->getResult(); $this->pageRestrictions = $pageSet->getCustomField('page_restrictions'); @@ -283,7 +283,7 @@ class ApiQueryInfo extends ApiQueryBase { if (isset($this->protections[$title->getNamespace()][$title->getDBkey()])) $pageInfo['protection'] = $this->protections[$title->getNamespace()][$title->getDBkey()]; - $result->setIndexedTagName($pageInfo['protection'], 'pr'); + $this->getResult()->setIndexedTagName($pageInfo['protection'], 'pr'); } if($this->fld_talkid && isset($this->talkids[$title->getNamespace()][$title->getDBKey()])) $pageInfo['talkid'] = $this->talkids[$title->getNamespace()][$title->getDBKey()]; @@ -308,7 +308,7 @@ class ApiQueryInfo extends ApiQueryBase { $db = $this->getDB(); // Get normal protections for existing titles - $this->addTables('page_restrictions', 'page'); + $this->addTables(array('page_restrictions', 'page')); $this->addWhere('page_id=pr_page'); $this->addFields(array('pr_page', 'pr_type', 'pr_level', 'pr_expiry', 'pr_cascade', 'page_namespace', @@ -401,7 +401,7 @@ class ApiQueryInfo extends ApiQueryBase { $res = $this->select(__METHOD__); while($row = $db->fetchObject($res)) { $source = Title::makeTitle($row->page_namespace, $row->page_title); - $this->protections[$row->pt_namespace][$row->pt_title][] = array( + $this->protections[$row->tl_namespace][$row->tl_title][] = array( 'type' => $row->pr_type, 'level' => $row->pr_level, 'expiry' => Block::decodeExpiry($row->pr_expiry, TS_ISO_8601), -- 2.20.1