From: Chad Horohoe Date: Wed, 3 Dec 2008 16:29:12 +0000 (+0000) Subject: This has been moved to Database already, use that instead. X-Git-Tag: 1.31.0-rc.0~44143 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/fiche.php?a=commitdiff_plain;h=b43952c28d4a307f776114e380effc8a78516f11;p=lhc%2Fweb%2Fwiklou.git This has been moved to Database already, use that instead. --- 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() {