From b43952c28d4a307f776114e380effc8a78516f11 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Wed, 3 Dec 2008 16:29:12 +0000 Subject: [PATCH] This has been moved to Database already, use that instead. --- includes/FileStore.php | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/includes/FileStore.php b/includes/FileStore.php index a5b04a6792..278777b455 100644 --- a/includes/FileStore.php +++ b/includes/FileStore.php @@ -35,39 +35,22 @@ class FileStore { * This is attached to your master database connection, so if you * suffer an uncaught error the lock will be released when the * connection is closed. - * - * @todo Probably only works on MySQL. Abstract to the Database class? + * @see Database::lock() */ static function lock() { - global $wgDBtype; - if ($wgDBtype != 'mysql') - return true; $dbw = wfGetDB( DB_MASTER ); $lockname = $dbw->addQuotes( FileStore::lockName() ); - $result = $dbw->query( "SELECT GET_LOCK($lockname, 5) AS lockstatus", __METHOD__ ); - $row = $dbw->fetchObject( $result ); - $dbw->freeResult( $result ); - - if( $row->lockstatus == 1 ) { - return true; - } else { - wfDebug( __METHOD__." failed to acquire lock\n" ); - return false; - } + return $dbw->lock( $lockname, __METHOD__ ); } /** * Release the global file store lock. + * @see Database::unlock() */ static function unlock() { - global $wgDBtype; - if ($wgDBtype != 'mysql') - return true; $dbw = wfGetDB( DB_MASTER ); $lockname = $dbw->addQuotes( FileStore::lockName() ); - $result = $dbw->query( "SELECT RELEASE_LOCK($lockname)", __METHOD__ ); - $dbw->fetchObject( $result ); - $dbw->freeResult( $result ); + return $dbw->unlock( $lockname, __METHOD__ ); } private static function lockName() { -- 2.20.1