From: Roan Kattouw Date: Fri, 24 Oct 2008 22:22:40 +0000 (+0000) Subject: API: * Fix up r42471 which hardcoded pl_from instead of using $this->bl_from X-Git-Tag: 1.31.0-rc.0~44619 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=a901d184dd2d57b331361a5e78380e78aee3fa47;p=lhc%2Fweb%2Fwiklou.git API: * Fix up r42471 which hardcoded pl_from instead of using $this->bl_from * Fix the second half of bug 16076 (using pl_from>=123 in combination with multiple values for pl_namespace and pl_title causes filesort) * By pure accident this fixes a bug about list=backlinks&blredirect dropping results under obscure conditions --- diff --git a/includes/api/ApiQueryBacklinks.php b/includes/api/ApiQueryBacklinks.php index efc1a91b16..258a482c0a 100644 --- a/includes/api/ApiQueryBacklinks.php +++ b/includes/api/ApiQueryBacklinks.php @@ -113,7 +113,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { $this->addWhereFld($this->bl_ns, $this->rootTitle->getNamespace()); $this->addWhereFld('page_namespace', $this->params['namespace']); if(!is_null($this->contID)) - $this->addWhere("pl_from>={$this->contID}"); + $this->addWhere("{$this->bl_from}>={$this->contID}"); if($this->params['filterredir'] == 'redirects') $this->addWhereFld('page_is_redirect', 1); if($this->params['filterredir'] == 'nonredirects') @@ -147,7 +147,23 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { $this->addWhere($titleWhere); $this->addWhereFld('page_namespace', $this->params['namespace']); if(!is_null($this->redirID)) - $this->addWhere("pl_from>={$this->redirID}"); + { + $first = $this->redirTitles[0]; + $title = $db->strencode($first->getDBKey()); + $ns = $first->getNamespace(); + $from = $this->redirID; + if($this->hasNS) + $this->addWhere("{$this->bl_ns} > $ns OR ". + "({$this->bl_ns} = $ns AND ". + "({$this->bl_title} > '$title' OR ". + "({$this->bl_title} = '$title' AND ". + "{$this->bl_from} >= $from)))"); + else + $this->addWhere("{$this->bl_title} > '$title' OR ". + "({$this->bl_title} = '$title' AND ". + "{$this->bl_from} >= $from)"); + + } if($this->params['filterredir'] == 'redirects') $this->addWhereFld('page_is_redirect', 1); if($this->params['filterredir'] == 'nonredirects')