Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2276
category-redir-api.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 8:48 PM
2014-11-21 20:48:17 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
category-redir-api.patch
View Options
Index: includes/api/ApiQueryCategoryMembers.php
===================================================================
--- includes/api/ApiQueryCategoryMembers.php (revision 23171)
+++ includes/api/ApiQueryCategoryMembers.php (working copy)
@@ -63,6 +63,18 @@
$fld_title = isset($prop['title']);
$fld_sortkey = isset($prop['sortkey']);
+ // First, let's check if anything redirects to this cat
+ $cats = array($categoryTitle->getDBkey());
+ $db = $this->getDB();
+ $this->addTables(array('page', 'redirect'));
+ $this->addFields('page_title');
+ $this->addWhere('page_id = rd_from');
+ $this->addWhereFld('rd_title', $categoryTitle->getDBkey());
+ $res = $this->select(__METHOD__);
+ while($row = $db->fetchObject($res))
+ $cats[] = $row->page_title;
+ $this->resetQueryParams();
+
if (is_null($resultPageSet)) {
$this->addFields(array('cl_sortkey', 'page_namespace', 'page_title'));
$this->addFieldsIf('page_id', $fld_ids);
@@ -76,15 +88,13 @@
$this->addWhere('cl_from=page_id');
$this->setContinuation($params['continue']);
- $this->addWhereFld('cl_to', $categoryTitle->getDBkey());
+ $this->addWhereFld('cl_to', $cats);
$this->addWhereFld('page_namespace', $params['namespace']);
$this->addOption('ORDER BY', "cl_to, cl_sortkey, cl_from");
$limit = $params['limit'];
$this->addOption('LIMIT', $limit +1);
- $db = $this->getDB();
-
$data = array ();
$count = 0;
$lastSortKey = null;
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1852
Default Alt Text
category-redir-api.patch (1 KB)
Attached To
Mode
T5311: Automatic category redirects
Attached
Detach File
Event Timeline
Log In to Comment