r36755 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36754‎ | r36755 | r36756 >
Date:17:06, 27 June 2008
Author:demon
Status:old
Tags:
Comment:
Refactoring (un)lock. All the subclasses are currently returning true, except for mySQL. Makes more sense to put the no-op in the parent class then just subclass it as needed. Other things could maybe do this too.
Modified paths:
  • /trunk/phase3/includes/db/Database.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseMssql.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseOracle.php (modified) (history)
  • /trunk/phase3/includes/db/DatabasePostgres.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseSqlite.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabaseOracle.php
@@ -706,15 +706,5 @@
707707 function getServer() {
708708 return $this->mServer;
709709 }
710 -
711 - /**
712 - * No-op lock functions
713 - */
714 - public function lock( $lockName, $method ) {
715 - return true;
716 - }
717 - public function unlock( $lockName, $method ) {
718 - return true;
719 - }
720710
721711 } // end DatabaseOracle class
Index: trunk/phase3/includes/db/DatabasePostgres.php
@@ -1327,13 +1327,4 @@
13281328 return implode( ' || ', $stringList );
13291329 }
13301330
1331 - /* These are not used yet, but we know we don't want the default version */
1332 -
1333 - public function lock( $lockName, $method ) {
1334 - return true;
1335 - }
1336 - public function unlock( $lockName, $method ) {
1337 - return true;
1338 - }
1339 -
13401331 } // end DatabasePostgres class
Index: trunk/phase3/includes/db/Database.php
@@ -2236,6 +2236,32 @@
22372237 }
22382238
22392239 /**
 2240+ * Acquire a lock, no-op to be overridden
 2241+ * by subclasses as needed.
 2242+ */
 2243+ public function lock( $lockName, $method ) {
 2244+ return true;
 2245+ }
 2246+ /**
 2247+ * Release a lock, no-op to be overridden
 2248+ * by subclasses as needed.
 2249+ */
 2250+ public function unlock( $lockName, $method ) {
 2251+ return true;
 2252+ }
 2253+}
 2254+
 2255+/**
 2256+ * Database abstraction object for mySQL
 2257+ * Inherit all methods and properties of Database::Database(),
 2258+ * except for locking.
 2259+ *
 2260+ * @ingroup Database
 2261+ * @see Database
 2262+ */
 2263+class DatabaseMysql extends Database {
 2264+
 2265+ /**
22402266 * Acquire a lock
22412267 *
22422268 * Abstracted from Filestore::lock() so child classes can implement for
@@ -2258,6 +2284,7 @@
22592285 return false;
22602286 }
22612287 }
 2288+
22622289 /**
22632290 * Release a lock.
22642291 *
@@ -2274,17 +2301,6 @@
22752302 }
22762303 }
22772304
2278 -/**
2279 - * Database abstraction object for mySQL
2280 - * Inherit all methods and properties of Database::Database()
2281 - *
2282 - * @ingroup Database
2283 - * @see Database
2284 - */
2285 -class DatabaseMysql extends Database {
2286 - # Inherit all
2287 -}
2288 -
22892305 /******************************************************************************
22902306 * Utility classes
22912307 *****************************************************************************/
Index: trunk/phase3/includes/db/DatabaseMssql.php
@@ -997,16 +997,6 @@
998998 $this->query("$sql $matches[1],$matches[2])");
999999 }
10001000 }
1001 -
1002 - /**
1003 - * No-op lock functions
1004 - */
1005 - public function lock( $lockName, $method ) {
1006 - return true;
1007 - }
1008 - public function unlock( $lockName, $method ) {
1009 - return true;
1010 - }
10111001
10121002 }
10131003
Index: trunk/phase3/includes/db/DatabaseSqlite.php
@@ -373,16 +373,6 @@
374374 $this->query("$sql $matches[1],$matches[2])");
375375 }
376376 }
377 -
378 - /**
379 - * No-op lock functions
380 - */
381 - public function lock( $lockName, $method ) {
382 - return true;
383 - }
384 - public function unlock( $lockName, $method ) {
385 - return true;
386 - }
387377
388378 }
389379

Follow-up revisions

RevisionCommit summaryAuthorDate
r36936Revert r36755 for the moment; various things use 'new Database'...brion18:22, 2 July 2008

Status & tagging log