From: Max Semenik Date: Sun, 25 Oct 2009 09:42:00 +0000 (+0000) Subject: * Abstracted table locks in maintenance/updateSearchIndex.php X-Git-Tag: 1.31.0-rc.0~39127 X-Git-Url: http://git.cyclocoop.org/%22%2C%20generer_url_ecrire%28?a=commitdiff_plain;h=08b430460adb4c5daf9ef3fa98cec02fe260a602;p=lhc%2Fweb%2Fwiklou.git * Abstracted table locks in maintenance/updateSearchIndex.php * Fixed MySQL's table locking, stabstabstab PHP --- 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__ ); } /**