Index: trunk/phase3/includes/api/ApiQueryCategoryMembers.php |
— | — | @@ -90,9 +90,9 @@ |
91 | 91 | |
92 | 92 | $this->addFieldsIf( 'cl_timestamp', $fld_timestamp || $params['sort'] == 'timestamp' ); |
93 | 93 | $this->addFieldsIf( 'cl_type', $fld_type ); |
| 94 | + |
94 | 95 | $this->addTables( array( 'page', 'categorylinks' ) ); // must be in this order for 'USE INDEX' |
95 | 96 | |
96 | | - $this->addWhere( 'cl_from=page_id' ); |
97 | 97 | $this->setContinuation( $params['continue'], $params['dir'] ); |
98 | 98 | $this->addWhereFld( 'cl_to', $categoryTitle->getDBkey() ); |
99 | 99 | |
— | — | @@ -112,21 +112,23 @@ |
113 | 113 | |
114 | 114 | if ( $params['sort'] == 'timestamp' ) { |
115 | 115 | $this->addWhereRange( 'cl_timestamp', |
116 | | - $dir, |
117 | | - $params['start'], |
118 | | - $params['end'] ); |
| 116 | + $dir, |
| 117 | + $params['start'], |
| 118 | + $params['end'] ); |
119 | 119 | |
120 | 120 | $this->addOption( 'USE INDEX', 'cl_timestamp' ); |
121 | 121 | } else { |
122 | 122 | $this->addWhereRange( 'cl_sortkey', |
123 | | - $dir, |
124 | | - $params['startsortkey'], |
125 | | - $params['endsortkey'] ); |
| 123 | + $dir, |
| 124 | + $params['startsortkey'], |
| 125 | + $params['endsortkey'] ); |
126 | 126 | |
127 | 127 | $this->addWhereRange( 'cl_from', $dir, null, null ); |
128 | 128 | $this->addOption( 'USE INDEX', 'cl_sortkey' ); |
129 | 129 | } |
130 | 130 | |
| 131 | + $this->addWhere( 'cl_from=page_id' ); |
| 132 | + |
131 | 133 | $limit = $params['limit']; |
132 | 134 | $this->addOption( 'LIMIT', $limit + 1 ); |
133 | 135 | |