From 5b8213e9efc8807b9bf2c67ce86106a938cdf2be Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Sat, 10 May 2008 10:49:26 +0000 Subject: * Re-applying r34449, r34500 and r34518 which Brion reverted by accident * Adding ApiQueryBase::addJoinConds() as wrapper for Database::select()'s $join_conds parameter * Migrating query modules to addJoinConds() * Using implicit join rather than INNER JOIN in ApiQueryBacklinks * Using FORCE INDEX (times) on logging table in ApiQueryLogEvents; although MySQL 4 seems to pick this index automatically (evidenced by the fact the WMF servers are still alive), MySQL 5 doesn't and filesorts * Replacing LEFT JOIN with implicit (inner) join in ApiQueryContributions: revisions without a corresponding page table entry shouldn't be shown anyway --- includes/api/ApiQueryAllpages.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'includes/api/ApiQueryAllpages.php') diff --git a/includes/api/ApiQueryAllpages.php b/includes/api/ApiQueryAllpages.php index 4758542e5e91..222b42ad4a84 100644 --- a/includes/api/ApiQueryAllpages.php +++ b/includes/api/ApiQueryAllpages.php @@ -57,6 +57,7 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase { $params = $this->extractRequestParams(); // Page filters + $this->addTables('page'); if (!$this->addWhereIf('page_is_redirect = 1', $params['filterredir'] === 'redirects')) $this->addWhereIf('page_is_redirect = 0', $params['filterredir'] === 'nonredirects'); $this->addWhereFld('page_namespace', $params['namespace']); @@ -97,18 +98,14 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase { } if($params['filterlanglinks'] == 'withoutlanglinks') { - $pageName = $this->getDB()->tableName('page'); - $llName = $this->getDB()->tableName('langlinks'); - $tables = "$pageName LEFT JOIN $llName ON page_id=ll_from"; + $this->addTables('langlinks'); + $this->addJoinConds(array('langlinks' => array('LEFT JOIN', 'page_id=ll_from'))); $this->addWhere('ll_from IS NULL'); - $this->addTables($tables); $forceNameTitleIndex = false; } else if($params['filterlanglinks'] == 'withlanglinks') { - $this->addTables(array('page', 'langlinks')); + $this->addTables('langlinks'); $this->addWhere('page_id=ll_from'); $forceNameTitleIndex = false; - } else { - $this->addTables('page'); } if ($forceNameTitleIndex) $this->addOption('USE INDEX', 'name_title'); -- cgit v1.2.3