From dffad97346c4fc5c380c8b53356f223312fcfb25 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Thu, 25 Feb 2010 23:06:33 +0000 Subject: [PATCH] Fix for MySQL 4.0 --- maintenance/storage/fixBug20757.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/maintenance/storage/fixBug20757.php b/maintenance/storage/fixBug20757.php index 922d47259a..694c501da2 100644 --- a/maintenance/storage/fixBug20757.php +++ b/maintenance/storage/fixBug20757.php @@ -31,6 +31,16 @@ class FixBug20757 extends Maintenance { $totalRevs = $dbr->selectField( 'text', 'MAX(old_id)', false, __METHOD__ ); + if ( $dbr->getType() == 'mysql' + && version_compare( $dbr->getServerVersion(), '4.1.0', '>=' ) ) + { + // In MySQL 4.1+, the binary field old_text has a non-working LOWER() function + $lowerLeft = 'LOWER(CONVERT(LEFT(old_text,22) USING latin1))'; + } else { + // No CONVERT() in MySQL 4.0 + $lowerLeft = 'LOWER(LEFT(old_text,22))'; + } + while ( true ) { print "ID: $startId / $totalRevs\r"; @@ -40,7 +50,7 @@ class FixBug20757 extends Maintenance { array( 'old_id > ' . intval( $startId ), 'old_flags LIKE \'%object%\' AND old_flags NOT LIKE \'%external%\'', - 'LOWER(CONVERT(LEFT(old_text,22) USING latin1)) = \'o:15:"historyblobstub"\'', + "$lowerLeft = 'o:15:\"historyblobstub\"'", ), __METHOD__, array( -- 2.20.1