Index: trunk/phase3/includes/SpecialAllpages.php |
— | — | @@ -101,7 +101,11 @@ |
102 | 102 | $lines = $wgMemc->get( $key ); |
103 | 103 | |
104 | 104 | if( !is_array( $lines ) ) { |
105 | | - $firstTitle = $dbr->selectField( 'page', 'page_title', $where, $fname, array( 'LIMIT' => 1 ) ); |
| 105 | + $options = array( 'LIMIT' => 1 ); |
| 106 | + if ( ! $dbr->implicitOrderby() ) { |
| 107 | + $options['ORDER BY'] = 'page_title'; |
| 108 | + } |
| 109 | + $firstTitle = $dbr->selectField( 'page', 'page_title', $where, $fname, $options ); |
106 | 110 | $lastTitle = $firstTitle; |
107 | 111 | |
108 | 112 | # This array is going to hold the page_titles in order. |
— | — | @@ -293,8 +297,11 @@ |
294 | 298 | } else { |
295 | 299 | # The previous chunk is not complete, need to link to the very first title |
296 | 300 | # available in the database |
297 | | - $reallyFirstPage_title = $dbr->selectField( 'page', 'page_title', array( 'page_namespace' => $namespace ), $fname, array( 'LIMIT' => 1) ); |
298 | | - |
| 301 | + $options = array( 'LIMIT' => 1 ); |
| 302 | + if ( ! $dbr->implicitOrderby() ) { |
| 303 | + $options['ORDER BY'] = 'page_title'; |
| 304 | + } |
| 305 | + $reallyFirstPage_title = $dbr->selectField( 'page', 'page_title', array( 'page_namespace' => $namespace ), $fname, $options ); |
299 | 306 | # Show the previous link if it s not the current requested chunk |
300 | 307 | if( $from != $reallyFirstPage_title ) { |
301 | 308 | $prevTitle = Title::makeTitle( $namespace, $reallyFirstPage_title ); |
Index: trunk/phase3/includes/DatabaseOracle.php |
— | — | @@ -128,6 +128,9 @@ |
129 | 129 | function implicitGroupby() { |
130 | 130 | return false; |
131 | 131 | } |
| 132 | + function implicitOrderby() { |
| 133 | + return false; |
| 134 | + } |
132 | 135 | function searchableIPs() { |
133 | 136 | return true; |
134 | 137 | } |
Index: trunk/phase3/includes/DatabasePostgres.php |
— | — | @@ -102,6 +102,9 @@ |
103 | 103 | function implicitGroupby() { |
104 | 104 | return false; |
105 | 105 | } |
| 106 | + function implicitOrderby() { |
| 107 | + return false; |
| 108 | + } |
106 | 109 | function searchableIPs() { |
107 | 110 | return true; |
108 | 111 | } |
Index: trunk/phase3/includes/Database.php |
— | — | @@ -441,6 +441,14 @@ |
442 | 442 | } |
443 | 443 | |
444 | 444 | /** |
| 445 | + * Returns true if this database does an implicit order by when the column has an index |
| 446 | + * For example: SELECT page_title FROM page LIMIT 1 |
| 447 | + */ |
| 448 | + function implicitOrderby() { |
| 449 | + return true; |
| 450 | + } |
| 451 | + |
| 452 | + /** |
445 | 453 | * Returns true if this database can do a native search on IP columns |
446 | 454 | * e.g. this works as expected: .. WHERE rc_ip = '127.42.12.102/32'; |
447 | 455 | */ |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -429,6 +429,8 @@ |
430 | 430 | * (bug 8393) <sup> and <sub> need to be preserved (without attributes) for |
431 | 431 | entries in the table of contents |
432 | 432 | * (bug 11114) Fix regression in read-only mode error display during editing |
| 433 | +* Force non-MySQL databases to use an ORDER BY in SpecialAllpages to ensure |
| 434 | + that the first page_title is truly the first page title. |
433 | 435 | |
434 | 436 | == API changes since 1.10 == |
435 | 437 | |