From 08b430460adb4c5daf9ef3fa98cec02fe260a602 Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Sun, 25 Oct 2009 09:42:00 +0000 Subject: [PATCH] * Abstracted table locks in maintenance/updateSearchIndex.php * Fixed MySQL's table locking, stabstabstab PHP --- includes/db/DatabaseMysql.php | 2 +- maintenance/updateSearchIndex.php | 13 ++----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/includes/db/DatabaseMysql.php b/includes/db/DatabaseMysql.php index 40425466d7..48b21a2486 100644 --- a/includes/db/DatabaseMysql.php +++ b/includes/db/DatabaseMysql.php @@ -348,7 +348,7 @@ class DatabaseMysql extends DatabaseBase { foreach( $write as $table ) { $tbl = $this->tableName( $table ) . - $lowPriority ? ' LOW_PRIORITY' : '' . + ( $lowPriority ? ' LOW_PRIORITY' : '' ) . ' WRITE'; $items[] = $tbl; } diff --git a/maintenance/updateSearchIndex.php b/maintenance/updateSearchIndex.php index 0adfd15219..6bb290ff1d 100644 --- a/maintenance/updateSearchIndex.php +++ b/maintenance/updateSearchIndex.php @@ -147,16 +147,7 @@ class UpdateSearchIndex extends Maintenance { private function lockSearchindex( &$db ) { $write = array( 'searchindex' ); $read = array( 'page', 'revision', 'text', 'interwiki' ); - $items = array(); - - foreach( $write as $table ) { - $items[] = $db->tableName( $table ) . ' LOW_PRIORITY WRITE'; - } - foreach( $read as $table ) { - $items[] = $db->tableName( $table ) . ' READ'; - } - $sql = "LOCK TABLES " . implode( ',', $items ); - $db->query( $sql, 'updateSearchIndex.php ' . __METHOD__ ); + $db->lockTables( $read, $write, 'updateSearchIndex.php ' . __METHOD__ ); } /** @@ -164,7 +155,7 @@ class UpdateSearchIndex extends Maintenance { * @param &$db Database object */ private function unlockSearchindex( &$db ) { - $db->query( "UNLOCK TABLES", 'updateSearchIndex.php ' . __METHOD__ ); + $db->unlockTables( 'updateSearchIndex.php ' . __METHOD__ ); } /** -- 2.20.1