Index: trunk/phase3/RELEASE-NOTES-1.19 |
— | — | @@ -120,6 +120,9 @@ |
121 | 121 | * (bug 26885) Allow show/hide of account blocks, temporary blocks and single IP |
122 | 122 | address blocks for list=blocks. |
123 | 123 | * (bug 30591) Add support to only return keys in ApiAllMessages. |
| 124 | +* (bug 29392) Setting the start or end parameter now works with lists blocks, |
| 125 | + categorymembers, deletedrevs, logevents, protectedtitles, usercontributions |
| 126 | + and watchlist in Postgres |
124 | 127 | |
125 | 128 | === Languages updated in 1.19 === |
126 | 129 | |
Index: trunk/phase3/includes/api/ApiQueryRecentChanges.php |
— | — | @@ -140,7 +140,7 @@ |
141 | 141 | */ |
142 | 142 | $this->addTables( 'recentchanges' ); |
143 | 143 | $index = array( 'recentchanges' => 'rc_timestamp' ); // May change |
144 | | - $this->addWhereRange( 'rc_timestamp', $params['dir'], $params['start'], $params['end'] ); |
| 144 | + $this->addTimestampWhereRange( 'rc_timestamp', $params['dir'], $params['start'], $params['end'] ); |
145 | 145 | $this->addWhereFld( 'rc_namespace', $params['namespace'] ); |
146 | 146 | $this->addWhereFld( 'rc_deleted', 0 ); |
147 | 147 | |
Index: trunk/phase3/includes/api/ApiQueryDeletedrevs.php |
— | — | @@ -191,7 +191,7 @@ |
192 | 192 | $this->addWhereRange( 'ar_namespace', $dir, null, null ); |
193 | 193 | $this->addWhereRange( 'ar_title', $dir, null, null ); |
194 | 194 | } |
195 | | - $this->addWhereRange( 'ar_timestamp', $dir, $params['start'], $params['end'] ); |
| 195 | + $this->addTimestampWhereRange( 'ar_timestamp', $dir, $params['start'], $params['end'] ); |
196 | 196 | } |
197 | 197 | $res = $this->select( __METHOD__ ); |
198 | 198 | $pageMap = array(); // Maps ns&title to (fake) pageid |
Index: trunk/phase3/includes/api/ApiQueryBase.php |
— | — | @@ -220,6 +220,16 @@ |
221 | 221 | } |
222 | 222 | } |
223 | 223 | } |
| 224 | + /** |
| 225 | + * Add a WHERE clause corresponding to a range, similar to addWhereRange, |
| 226 | + * but converts $start and $end to database timestamps. |
| 227 | + * @see addWhereRange |
| 228 | + */ |
| 229 | + protected function addTimestampWhereRange( $field, $dir, $start, $end, $sort = true ) { |
| 230 | + $db = $this->getDb(); |
| 231 | + return $this->addWhereRange( $field, $dir, |
| 232 | + $db->timestamp( $start ), $db->timestamp( $end ), $sort ); |
| 233 | + } |
224 | 234 | |
225 | 235 | /** |
226 | 236 | * Add an option such as LIMIT or USE INDEX. If an option was set |
Index: trunk/phase3/includes/api/ApiQueryBlocks.php |
— | — | @@ -81,7 +81,7 @@ |
82 | 82 | $fld_flags ); |
83 | 83 | |
84 | 84 | $this->addOption( 'LIMIT', $params['limit'] + 1 ); |
85 | | - $this->addWhereRange( 'ipb_timestamp', $params['dir'], $params['start'], $params['end'] ); |
| 85 | + $this->addTimestampWhereRange( 'ipb_timestamp', $params['dir'], $params['start'], $params['end'] ); |
86 | 86 | if ( isset( $params['ids'] ) ) { |
87 | 87 | $this->addWhereFld( 'ipb_id', $params['ids'] ); |
88 | 88 | } |
Index: trunk/phase3/includes/api/ApiQueryLogEvents.php |
— | — | @@ -116,7 +116,7 @@ |
117 | 117 | $index['logging'] = 'type_time'; |
118 | 118 | } |
119 | 119 | |
120 | | - $this->addWhereRange( 'log_timestamp', $params['dir'], $params['start'], $params['end'] ); |
| 120 | + $this->addTimestampWhereRange( 'log_timestamp', $params['dir'], $params['start'], $params['end'] ); |
121 | 121 | |
122 | 122 | $limit = $params['limit']; |
123 | 123 | $this->addOption( 'LIMIT', $limit + 1 ); |
Index: trunk/phase3/includes/api/ApiQueryProtectedTitles.php |
— | — | @@ -64,7 +64,7 @@ |
65 | 65 | $this->addFieldsIf( 'pt_expiry', isset( $prop['expiry'] ) ); |
66 | 66 | $this->addFieldsIf( 'pt_create_perm', isset( $prop['level'] ) ); |
67 | 67 | |
68 | | - $this->addWhereRange( 'pt_timestamp', $params['dir'], $params['start'], $params['end'] ); |
| 68 | + $this->addTimestampWhereRange( 'pt_timestamp', $params['dir'], $params['start'], $params['end'] ); |
69 | 69 | $this->addWhereFld( 'pt_namespace', $params['namespace'] ); |
70 | 70 | $this->addWhereFld( 'pt_create_perm', $params['level'] ); |
71 | 71 | |
Index: trunk/phase3/includes/api/ApiQueryWatchlist.php |
— | — | @@ -134,9 +134,8 @@ |
135 | 135 | |
136 | 136 | $db = $this->getDB(); |
137 | 137 | |
138 | | - $this->addWhereRange( 'rc_timestamp', $params['dir'], |
139 | | - $db->timestamp( $params['start'] ), |
140 | | - $db->timestamp( $params['end'] ) ); |
| 138 | + $this->addTimestampWhereRange( 'rc_timestamp', $params['dir'], |
| 139 | + $params['start'], $params['end'] ); |
141 | 140 | $this->addWhereFld( 'wl_namespace', $params['namespace'] ); |
142 | 141 | |
143 | 142 | if ( !$params['allrev'] ) { |
Index: trunk/phase3/includes/api/ApiQueryRevisions.php |
— | — | @@ -252,14 +252,14 @@ |
253 | 253 | // one row with the same timestamp for the same page. |
254 | 254 | // The order needs to be the same as start parameter to avoid SQL filesort. |
255 | 255 | if ( is_null( $params['startid'] ) && is_null( $params['endid'] ) ) { |
256 | | - $this->addWhereRange( 'rev_timestamp', $params['dir'], |
| 256 | + $this->addTimestampWhereRange( 'rev_timestamp', $params['dir'], |
257 | 257 | $params['start'], $params['end'] ); |
258 | 258 | } else { |
259 | 259 | $this->addWhereRange( 'rev_id', $params['dir'], |
260 | 260 | $params['startid'], $params['endid'] ); |
261 | 261 | // One of start and end can be set |
262 | 262 | // If neither is set, this does nothing |
263 | | - $this->addWhereRange( 'rev_timestamp', $params['dir'], |
| 263 | + $this->addTimestampWhereRange( 'rev_timestamp', $params['dir'], |
264 | 264 | $params['start'], $params['end'], false ); |
265 | 265 | } |
266 | 266 | |
Index: trunk/phase3/includes/api/ApiQueryUserContributions.php |
— | — | @@ -182,7 +182,7 @@ |
183 | 183 | if ( $this->multiUserMode ) { |
184 | 184 | $this->addWhereRange( 'rev_user_text', $this->params['dir'], null, null ); |
185 | 185 | } |
186 | | - $this->addWhereRange( 'rev_timestamp', |
| 186 | + $this->addTimestampWhereRange( 'rev_timestamp', |
187 | 187 | $this->params['dir'], $this->params['start'], $this->params['end'] ); |
188 | 188 | $this->addWhereFld( 'page_namespace', $this->params['namespace'] ); |
189 | 189 | |