Revision: 51795
Author:   simetrical
Date:     2009-06-12 17:59:04 +0000 (Fri, 12 Jun 2009)

Log Message:
-----------
Make Database into abstract class DatabaseBase

All other databases were changed to extend DatabaseBase instead of
Database.  Database was kept as an alias for DatabaseMysql for
compatibility.  Existing explicit references to Database that I could
find were changed to DatabaseMysql for the sake of clarity.

Should cause no functional changes.

Modified Paths:
--------------
    trunk/extensions/BoardVote/BoardVote_body.php
    trunk/extensions/MWSearch/luceneUpdate.php
    trunk/phase3/includes/AutoLoader.php
    trunk/phase3/includes/db/Database.php
    trunk/phase3/includes/db/DatabaseIbm_db2.php
    trunk/phase3/includes/db/DatabaseMssql.php
    trunk/phase3/includes/db/DatabaseOracle.php
    trunk/phase3/includes/db/DatabasePostgres.php
    trunk/phase3/includes/db/DatabaseSqlite.php
    trunk/phase3/t/inc/Database.t
    trunk/phase3/tests/MediaWiki_TestCase.php
    trunk/tools/WikipediaStatistics/index.php
    trunk/tools/switch-master/MasterSwitcher.php

Modified: trunk/extensions/BoardVote/BoardVote_body.php
===================================================================
--- trunk/extensions/BoardVote/BoardVote_body.php       2009-06-12 17:55:48 UTC 
(rev 51794)
+++ trunk/extensions/BoardVote/BoardVote_body.php       2009-06-12 17:59:04 UTC 
(rev 51795)
@@ -215,7 +215,7 @@
                if ( !$this->mDb ) {
                        global $wgBoardVoteDBServer, $wgBoardVoteDB, $wgDBuser, 
$wgDBpassword;
 
-                       $this->mDb = new Database( $wgBoardVoteDBServer, 
$wgDBuser, $wgDBpassword,
+                       $this->mDb = new DatabaseMysql( $wgBoardVoteDBServer, 
$wgDBuser, $wgDBpassword,
                                $wgBoardVoteDB, /*failfn*/false, /*flags*/0, 
/*prefix*/'' );
                        if ( !$this->mDb->isOpen() ) {
                                // This should be handled inside the 
constructor, but we'll check just in case

Modified: trunk/extensions/MWSearch/luceneUpdate.php
===================================================================
--- trunk/extensions/MWSearch/luceneUpdate.php  2009-06-12 17:55:48 UTC (rev 
51794)
+++ trunk/extensions/MWSearch/luceneUpdate.php  2009-06-12 17:59:04 UTC (rev 
51795)
@@ -122,7 +122,7 @@
        
        function &streamingSlave( $db ) {
                global $wgDBname;
-               $stream = new Database( $db->mServer, $db->mUser, 
$db->mPassword, $wgDBname );
+               $stream = new DatabaseMysql( $db->mServer, $db->mUser, 
$db->mPassword, $wgDBname );
                $stream->bufferResults( false );
                
                $timeout = 3600 * 24;

Modified: trunk/phase3/includes/AutoLoader.php
===================================================================
--- trunk/phase3/includes/AutoLoader.php        2009-06-12 17:55:48 UTC (rev 
51794)
+++ trunk/phase3/includes/AutoLoader.php        2009-06-12 17:59:04 UTC (rev 
51795)
@@ -303,6 +303,7 @@
        'Blob' => 'includes/db/Database.php',
        'ChronologyProtector' => 'includes/db/LBFactory.php',
        'Database' => 'includes/db/Database.php',
+       'DatabaseBase' => 'includes/db/Database.php',
        'DatabaseMssql' => 'includes/db/DatabaseMssql.php',
        'DatabaseMysql' => 'includes/db/Database.php',
        'DatabaseOracle' => 'includes/db/DatabaseOracle.php',

Modified: trunk/phase3/includes/db/Database.php
===================================================================
--- trunk/phase3/includes/db/Database.php       2009-06-12 17:55:48 UTC (rev 
51794)
+++ trunk/phase3/includes/db/Database.php       2009-06-12 17:59:04 UTC (rev 
51795)
@@ -19,7 +19,7 @@
  * Database abstraction object
  * @ingroup Database
  */
-class Database {
+abstract class DatabaseBase {
 
 #------------------------------------------------------------------------------
 # Variables
@@ -307,7 +307,7 @@
        }
 
        /**
-        * Same as new Database( ... ), kept for backward compatibility
+        * Same as new DatabaseMysql( ... ), kept for backward compatibility
         * @param $server String: database server host
         * @param $user String: database user name
         * @param $password String: database user password
@@ -317,7 +317,7 @@
         */
        static function newFromParams( $server, $user, $password, $dbName, 
$failFunction = false, $flags = 0 )
        {
-               return new Database( $server, $user, $password, $dbName, 
$failFunction, $flags );
+               return new DatabaseMysql( $server, $user, $password, $dbName, 
$failFunction, $flags );
        }
 
        /**
@@ -2426,10 +2426,15 @@
  * @ingroup Database
  * @see Database
  */
-class DatabaseMysql extends Database {
+class DatabaseMysql extends DatabaseBase {
        # Inherit all
 }
 
+/**
+ * Legacy support: Database == DatabaseMysql
+ */
+class Database extends DatabaseMysql {}
+
 /******************************************************************************
  * Utility classes
  *****************************************************************************/

Modified: trunk/phase3/includes/db/DatabaseIbm_db2.php
===================================================================
--- trunk/phase3/includes/db/DatabaseIbm_db2.php        2009-06-12 17:55:48 UTC 
(rev 51794)
+++ trunk/phase3/includes/db/DatabaseIbm_db2.php        2009-06-12 17:59:04 UTC 
(rev 51795)
@@ -102,7 +102,7 @@
  * Primary database interface
  * @ingroup Database
  */
-class DatabaseIbm_db2 extends Database {
+class DatabaseIbm_db2 extends DatabaseBase {
        /*
         * Inherited members
        protected $mLastQuery = '';

Modified: trunk/phase3/includes/db/DatabaseMssql.php
===================================================================
--- trunk/phase3/includes/db/DatabaseMssql.php  2009-06-12 17:55:48 UTC (rev 
51794)
+++ trunk/phase3/includes/db/DatabaseMssql.php  2009-06-12 17:59:04 UTC (rev 
51795)
@@ -10,7 +10,7 @@
 /**
  * @ingroup Database
  */
-class DatabaseMssql extends Database {
+class DatabaseMssql extends DatabaseBase {
 
        var $mAffectedRows;
        var $mLastResult;

Modified: trunk/phase3/includes/db/DatabaseOracle.php
===================================================================
--- trunk/phase3/includes/db/DatabaseOracle.php 2009-06-12 17:55:48 UTC (rev 
51794)
+++ trunk/phase3/includes/db/DatabaseOracle.php 2009-06-12 17:59:04 UTC (rev 
51795)
@@ -153,7 +153,7 @@
 /**
  * @ingroup Database
  */
-class DatabaseOracle extends Database {
+class DatabaseOracle extends DatabaseBase {
        var $mInsertId = NULL;
        var $mLastResult = NULL;
        var $numeric_version = NULL;

Modified: trunk/phase3/includes/db/DatabasePostgres.php
===================================================================
--- trunk/phase3/includes/db/DatabasePostgres.php       2009-06-12 17:55:48 UTC 
(rev 51794)
+++ trunk/phase3/includes/db/DatabasePostgres.php       2009-06-12 17:59:04 UTC 
(rev 51795)
@@ -68,7 +68,7 @@
 /**
  * @ingroup Database
  */
-class DatabasePostgres extends Database {
+class DatabasePostgres extends DatabaseBase {
        var $mInsertId = NULL;
        var $mLastResult = NULL;
        var $numeric_version = NULL;

Modified: trunk/phase3/includes/db/DatabaseSqlite.php
===================================================================
--- trunk/phase3/includes/db/DatabaseSqlite.php 2009-06-12 17:55:48 UTC (rev 
51794)
+++ trunk/phase3/includes/db/DatabaseSqlite.php 2009-06-12 17:59:04 UTC (rev 
51795)
@@ -10,7 +10,7 @@
 /**
  * @ingroup Database
  */
-class DatabaseSqlite extends Database {
+class DatabaseSqlite extends DatabaseBase {
 
        var $mAffectedRows;
        var $mLastResult;

Modified: trunk/phase3/t/inc/Database.t
===================================================================
--- trunk/phase3/t/inc/Database.t       2009-06-12 17:55:48 UTC (rev 51794)
+++ trunk/phase3/t/inc/Database.t       2009-06-12 17:59:04 UTC (rev 51795)
@@ -12,7 +12,7 @@
 
 plan( 9 );
 
-$db = new Database( $wgDBserver, $wgDBuser, $wgDBpassword );
+$db = new DatabaseMysql( $wgDBserver, $wgDBuser, $wgDBpassword );
 
 cmp_ok( $db->addQuotes( NULL ), '==',
        'NULL', 'Add quotes to NULL' );

Modified: trunk/phase3/tests/MediaWiki_TestCase.php
===================================================================
--- trunk/phase3/tests/MediaWiki_TestCase.php   2009-06-12 17:55:48 UTC (rev 
51794)
+++ trunk/phase3/tests/MediaWiki_TestCase.php   2009-06-12 17:59:04 UTC (rev 
51795)
@@ -8,7 +8,7 @@
        protected function buildTestDatabase( $tables ) {
                global $testOptions, $wgDBprefix, $wgDBserver, $wgDBadminuser, 
$wgDBadminpassword, $wgDBname;
                $wgDBprefix = 'parsertest_';
-               $db = new Database(
+               $db = new DatabaseMysql(
                        $wgDBserver,
                        $wgDBadminuser,
                        $wgDBadminpassword,

Modified: trunk/tools/WikipediaStatistics/index.php
===================================================================
--- trunk/tools/WikipediaStatistics/index.php   2009-06-12 17:55:48 UTC (rev 
51794)
+++ trunk/tools/WikipediaStatistics/index.php   2009-06-12 17:59:04 UTC (rev 
51795)
@@ -112,7 +112,7 @@
        <pre><?php
 
        if ( isset( $_POST['update'] ) ) {
-               $dbr = new Database();
+               $dbr = new DatabaseMysql();
                $dateRange = array(
                        sprintf(
                                'rev_timestamp > %s',

Modified: trunk/tools/switch-master/MasterSwitcher.php
===================================================================
--- trunk/tools/switch-master/MasterSwitcher.php        2009-06-12 17:55:48 UTC 
(rev 51794)
+++ trunk/tools/switch-master/MasterSwitcher.php        2009-06-12 17:59:04 UTC 
(rev 51795)
@@ -143,7 +143,7 @@
 
        function getConnection( $host ) {
                if ( !isset( $this->conns[$host] ) ) {
-                       $this->conns[$host] = new Database( $host, 
$this->rootUser, $this->rootPass );
+                       $this->conns[$host] = new DatabaseMysql( $host, 
$this->rootUser, $this->rootPass );
                }
                return $this->conns[$host];
        }



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to