Index: trunk/phase3/maintenance/storage/fixBug20757.php |
— | — | @@ -31,6 +31,16 @@ |
32 | 32 | |
33 | 33 | $totalRevs = $dbr->selectField( 'text', 'MAX(old_id)', false, __METHOD__ ); |
34 | 34 | |
| 35 | + if ( $dbr->getType() == 'mysql' |
| 36 | + && version_compare( $dbr->getServerVersion(), '4.1.0', '>=' ) ) |
| 37 | + { |
| 38 | + // In MySQL 4.1+, the binary field old_text has a non-working LOWER() function |
| 39 | + $lowerLeft = 'LOWER(CONVERT(LEFT(old_text,22) USING latin1))'; |
| 40 | + } else { |
| 41 | + // No CONVERT() in MySQL 4.0 |
| 42 | + $lowerLeft = 'LOWER(LEFT(old_text,22))'; |
| 43 | + } |
| 44 | + |
35 | 45 | while ( true ) { |
36 | 46 | print "ID: $startId / $totalRevs\r"; |
37 | 47 | |
— | — | @@ -40,7 +50,7 @@ |
41 | 51 | array( |
42 | 52 | 'old_id > ' . intval( $startId ), |
43 | 53 | 'old_flags LIKE \'%object%\' AND old_flags NOT LIKE \'%external%\'', |
44 | | - 'LOWER(CONVERT(LEFT(old_text,22) USING latin1)) = \'o:15:"historyblobstub"\'', |
| 54 | + "$lowerLeft = 'o:15:\"historyblobstub\"'", |
45 | 55 | ), |
46 | 56 | __METHOD__, |
47 | 57 | array( |