From: Chad Horohoe Date: Wed, 29 Jul 2009 23:41:16 +0000 (+0000) Subject: * Move generic return true; various for lock functions to parent, no need to implemen... X-Git-Tag: 1.31.0-rc.0~40644 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=df296de32e4b25de444778448dc6b9c34aae2530;p=lhc%2Fweb%2Fwiklou.git * Move generic return true; various for lock functions to parent, no need to implement this everywhere * Make LOW PRIORITY optional * Use sourceFile instead of dbsource --- diff --git a/includes/db/Database.php b/includes/db/Database.php index c505161521..246b2aff3f 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -2200,7 +2200,9 @@ abstract class DatabaseBase { * @param $method String: Name of method calling us * @return bool */ - abstract public function lock( $lockName, $method, $timeout = 5 ); + public function lock( $lockName, $method, $timeout = 5 ) { + return true; + } /** * Release a lock. @@ -2213,7 +2215,9 @@ abstract class DatabaseBase { * by this thread (in which case the lock is not released), and NULL if the named * lock did not exist */ - abstract public function unlock( $lockName, $method ); + public function unlock( $lockName, $method ) { + return true; + } /** * Lock specific tables @@ -2221,15 +2225,20 @@ abstract class DatabaseBase { * @param $read Array of tables to lock for read access * @param $write Array of tables to lock for write access * @param $method String name of caller + * @param $lowPriority bool Whether to indicate writes to be LOW PRIORITY */ - abstract public function lockTables( $read, $write, $method ); + public function lockTables( $read, $write, $method, $lowPriority = true ) { + return true; + } /** * Unlock specific tables * * @param $method String the caller */ - abstract public function unlockTables( $method ); + public function unlockTables( $method ) { + return true; + } /** * Get search engine class. All subclasses of this diff --git a/includes/db/DatabaseIbm_db2.php b/includes/db/DatabaseIbm_db2.php index aa0e7a5dc2..59b302477e 100644 --- a/includes/db/DatabaseIbm_db2.php +++ b/includes/db/DatabaseIbm_db2.php @@ -707,7 +707,7 @@ EOF; $this->applySchema(); $this->begin(); - $res = dbsource( "../maintenance/ibm_db2/tables.sql", $this); + $res = $this->sourceFile( "../maintenance/ibm_db2/tables.sql" ); $res = null; // TODO: update mediawiki_version table @@ -1527,13 +1527,6 @@ EOF; * TODO * @return bool true */ - public function lock( $lockName, $method ) { wfDebug('Not implemented for DB2: lock()'); return true; } - /** - * Not implemented - * TODO - * @return bool true - */ - public function unlock( $lockName, $method ) { wfDebug('Not implemented for DB2: unlock()'); return true; } /** * Not implemented * @deprecated diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php index acd1188bdb..9521a1ae0b 100644 --- a/includes/db/DatabaseMssql.php +++ b/includes/db/DatabaseMssql.php @@ -979,16 +979,6 @@ class DatabaseMssql extends DatabaseBase { } } - /** - * No-op lock functions - */ - public function lock( $lockName, $method ) { - return true; - } - public function unlock( $lockName, $method ) { - return true; - } - public function getSearchEngine() { return "SearchEngineDummy"; } diff --git a/includes/db/DatabaseMysql.php b/includes/db/DatabaseMysql.php index f86c405d97..104d1403f0 100644 --- a/includes/db/DatabaseMysql.php +++ b/includes/db/DatabaseMysql.php @@ -326,11 +326,14 @@ class DatabaseMysql extends DatabaseBase { return $row->lockstatus; } - public function lockTables( $read, $write, $method ) { + public function lockTables( $read, $write, $method, $lowPriority = true ) { $items = array(); foreach( $write as $table ) { - $items[] = $this->tableName( $table ) . ' LOW_PRIORITY WRITE'; + $tbl = $this->tableName( $table ) . + $lowPriority ? ' LOW_PRIORITY' : '' . + ' WRITE'; + $items[] = $tbl; } foreach( $read as $table ) { $items[] = $this->tableName( $table ) . ' READ'; diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index 351c591d8d..34ab158532 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -888,7 +888,7 @@ class DatabaseOracle extends DatabaseBase { global $wgVersion, $wgDBmwschema, $wgDBts2schema, $wgDBport, $wgDBuser; echo "
  • Creating DB objects
  • \n"; - $res = dbsource( "../maintenance/ora/tables.sql", $this); + $res = $this->sourceFile( "../maintenance/ora/tables.sql" ); // Avoid the non-standard "REPLACE INTO" syntax echo "
  • Populating table interwiki
  • \n"; @@ -1067,16 +1067,6 @@ class DatabaseOracle extends DatabaseBase { return parent::replaceVars($ins); } - /** - * No-op lock functions - */ - public function lock( $lockName, $method ) { - return true; - } - public function unlock( $lockName, $method ) { - return true; - } - public function getSearchEngine() { return "SearchOracle"; } diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index a485a66c38..db78cf2f85 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -1239,7 +1239,7 @@ END; } $this->doQuery("DROP TABLE $safeschema.$ctest"); - $res = dbsource( "../maintenance/postgres/tables.sql", $this); + $res = $this->sourceFile( "../maintenance/postgres/tables.sql" ); ## Update version information $mwv = $this->addQuotes($wgVersion); @@ -1394,22 +1394,7 @@ END; return implode( ' || ', $stringList ); } - /* These are not used yet, but we know we don't want the default version */ - - public function lock( $lockName, $method, $timeout = 5 ) { - return true; - } - public function unlock( $lockName, $method ) { - return true; - } - public function getSearchEngine() { return "SearchPostgres"; } - - /** Todo: maybe implement this? */ - public function lockTables( $read, $write, $method ) {} - - public function unlockTables( $method ) {} - } // end DatabasePostgres class diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php index 85f0b08d82..43ba8bc686 100644 --- a/includes/db/DatabaseSqlite.php +++ b/includes/db/DatabaseSqlite.php @@ -408,16 +408,6 @@ class DatabaseSqlite extends DatabaseBase { } } - /** - * No-op lock functions - */ - public function lock( $lockName, $method, $timeout = 5 ) { - return true; - } - public function unlock( $lockName, $method ) { - return true; - } - public function getSearchEngine() { return "SearchEngineDummy"; } @@ -459,10 +449,6 @@ class DatabaseSqlite extends DatabaseBase { return $s; } - public function lockTables( $read, $write, $method ) {} - - public function unlockTables( $method ) {} - /* * Build a concatenation list to feed into a SQL query */