Index: branches/wmf/1.17wmf1/includes/api/ApiQueryCategoryMembers.php |
— | — | @@ -107,7 +107,6 @@ |
108 | 108 | $this->addOption( 'USE INDEX', 'cl_timestamp' ); |
109 | 109 | } else { |
110 | 110 | if ( $params['continue'] ) { |
111 | | - // type|from|sortkey |
112 | 111 | $cont = explode( '|', $params['continue'], 3 ); |
113 | 112 | if ( count( $cont ) != 3 ) { |
114 | 113 | $this->dieUsage( 'Invalid continue param. You should pass the original value returned '. |
— | — | @@ -120,8 +119,9 @@ |
121 | 120 | $queryTypes = array_slice( $queryTypes, $contTypeIndex ); |
122 | 121 | |
123 | 122 | // Add a WHERE clause for sortkey and from |
124 | | - $from = intval( $cont[1] ); |
125 | | - $escSortkey = $this->getDB()->addQuotes( $cont[2] ); |
| 123 | + // pack( "H*", $foo ) is used to convert hex back to binary |
| 124 | + $escSortkey = $this->getDB()->addQuotes( pack( "H*", $cont[1] ) ); |
| 125 | + $from = intval( $cont[2] ); |
126 | 126 | $op = $dir == 'newer' ? '>' : '<'; |
127 | 127 | // $contWhere is used further down |
128 | 128 | $contWhere = "cl_sortkey $op $escSortkey OR " . |
— | — | @@ -181,12 +181,9 @@ |
182 | 182 | if ( $params['sort'] == 'timestamp' ) { |
183 | 183 | $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->cl_timestamp ) ); |
184 | 184 | } else { |
185 | | - // Continue format is type|from|sortkey |
186 | | - // The order is a bit weird but it's convenient to put the sortkey at the end |
187 | | - // because we don't have to worry about pipes in the sortkey that way |
188 | | - // (and type and from can't contain pipes anyway) |
| 185 | + $sortkey = bin2hex( $row->cl_sortkey ); |
189 | 186 | $this->setContinueEnumParameter( 'continue', |
190 | | - "{$row->cl_type}|{$row->cl_from}|{$row->cl_sortkey}" |
| 187 | + "{$row->cl_type}|$sortkey|{$row->cl_from}" |
191 | 188 | ); |
192 | 189 | } |
193 | 190 | break; |
— | — | @@ -210,7 +207,7 @@ |
211 | 208 | ApiQueryBase::addTitleInfo( $vals, $title ); |
212 | 209 | } |
213 | 210 | if ( $fld_sortkey ) { |
214 | | - $vals['sortkey'] = $row->cl_sortkey; |
| 211 | + $vals['sortkey'] = bin2hex( $row->cl_sortkey ); |
215 | 212 | } |
216 | 213 | if ( $fld_sortkeyprefix ) { |
217 | 214 | $vals['sortkeyprefix'] = $row->cl_sortkey_prefix; |
— | — | @@ -227,8 +224,9 @@ |
228 | 225 | if ( $params['sort'] == 'timestamp' ) { |
229 | 226 | $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->cl_timestamp ) ); |
230 | 227 | } else { |
| 228 | + $sortkey = bin2hex( $row->cl_sortkey ); |
231 | 229 | $this->setContinueEnumParameter( 'continue', |
232 | | - "{$row->cl_type}|{$row->cl_from}|{$row->cl_sortkey}" |
| 230 | + "{$row->cl_type}|$sortkey|{$row->cl_from}" |
233 | 231 | ); |
234 | 232 | } |
235 | 233 | break; |
— | — | @@ -317,7 +315,7 @@ |
318 | 316 | 'What pieces of information to include', |
319 | 317 | ' ids - Adds the page ID', |
320 | 318 | ' title - Adds the title and namespace ID of the page', |
321 | | - ' sortkey - Adds the sortkey used for sorting in the category (may not be human-readble)', |
| 319 | + ' sortkey - Adds the sortkey used for sorting in the category (hexadecimal string)', |
322 | 320 | ' sortkeyprefix - Adds the sortkey prefix used for sorting in the category (human-readable part of the sortkey)', |
323 | 321 | ' type - Adds the type that the page has been categorised as (page, subcat or file)', |
324 | 322 | ' timestamp - Adds the timestamp of when the page was included', |
Property changes on: branches/wmf/1.17wmf1/includes/api/ApiQueryCategoryMembers.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
325 | 323 | Merged /trunk/phase3/includes/api/ApiQueryCategoryMembers.php:r86257 |
Index: branches/wmf/1.17wmf1/includes/api/ApiQueryCategories.php |
— | — | @@ -66,7 +66,7 @@ |
67 | 67 | 'cl_to' |
68 | 68 | ) ); |
69 | 69 | |
70 | | - $this->addFieldsIf( 'cl_sortkey', isset( $prop['sortkey'] ) ); |
| 70 | + $this->addFieldsIf( array( 'cl_sortkey', 'cl_sortkey_prefix' ), isset( $prop['sortkey'] ) ); |
71 | 71 | $this->addFieldsIf( 'cl_timestamp', isset( $prop['timestamp'] ) ); |
72 | 72 | |
73 | 73 | $this->addTables( 'categorylinks' ); |
— | — | @@ -147,7 +147,8 @@ |
148 | 148 | $vals = array(); |
149 | 149 | ApiQueryBase::addTitleInfo( $vals, $title ); |
150 | 150 | if ( isset( $prop['sortkey'] ) ) { |
151 | | - $vals['sortkey'] = $row->cl_sortkey; |
| 151 | + $vals['sortkey'] = bin2hex( $row->cl_sortkey ); |
| 152 | + $vals['sortkeyprefix'] = $row->cl_sortkey_prefix; |
152 | 153 | } |
153 | 154 | if ( isset( $prop['timestamp'] ) ) { |
154 | 155 | $vals['timestamp'] = wfTimestamp( TS_ISO_8601, $row->cl_timestamp ); |
— | — | @@ -215,7 +216,7 @@ |
216 | 217 | return array( |
217 | 218 | 'prop' => array( |
218 | 219 | 'Which additional properties to get for each category', |
219 | | - ' sortkey - Adds the sortkey for the category', |
| 220 | + ' sortkey - Adds the sortkey (hexadecimal string) and sortkey prefix (human-readable part) for the category', |
220 | 221 | ' timestamp - Adds timestamp of when the category was added', |
221 | 222 | ' hidden - Tags categories that are hidden with __HIDDENCAT__', |
222 | 223 | ), |