For MediaWiki (recent comments | status changes | tags | authors | states | release notes)
Index: trunk/phase3/includes/api/ApiQueryBacklinks.php =================================================================== --- trunk/phase3/includes/api/ApiQueryBacklinks.php (revision 42511) +++ trunk/phase3/includes/api/ApiQueryBacklinks.php (revision 42512) @@ -113,7 +113,7 @@ $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 @@ $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')