Pass in some more , __METHOD__
authorSam Reed <reedy@users.mediawiki.org>
Thu, 10 Nov 2011 20:44:37 +0000 (20:44 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Thu, 10 Nov 2011 20:44:37 +0000 (20:44 +0000)
includes/installer/DatabaseUpdater.php
includes/installer/MysqlUpdater.php
includes/installer/SqliteUpdater.php
maintenance/convertUserOptions.php
maintenance/rebuildtextindex.php
tests/testHelpers.inc

index 4f6e7a9..58c1f4f 100644 (file)
@@ -316,7 +316,7 @@ abstract class DatabaseUpdater {
         */
        protected function canUseNewUpdatelog() {
                return $this->db->tableExists( 'updatelog', __METHOD__ ) &&
-                       $this->db->fieldExists( 'updatelog', 'ul_value' );
+                       $this->db->fieldExists( 'updatelog', 'ul_value', __METHOD__ );
        }
 
        /**
@@ -418,7 +418,7 @@ abstract class DatabaseUpdater {
        protected function addField( $table, $field, $patch, $fullpath = false ) {
                if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
                        $this->output( "...$table table does not exist, skipping new field patch\n" );
-               } elseif ( $this->db->fieldExists( $table, $field ) ) {
+               } elseif ( $this->db->fieldExists( $table, $field, __METHOD__ ) ) {
                        $this->output( "...have $field field in $table table.\n" );
                } else {
                        $this->output( "Adding $field field to table $table..." );
@@ -435,7 +435,7 @@ abstract class DatabaseUpdater {
         * @param $fullpath Boolean Whether to treat $patch path as a relative or not
         */
        protected function addIndex( $table, $index, $patch, $fullpath = false ) {
-               if ( $this->db->indexExists( $table, $index ) ) {
+               if ( $this->db->indexExists( $table, $index, __METHOD__ ) ) {
                        $this->output( "...$index key already set on $table table.\n" );
                } else {
                        $this->output( "Adding $index key to table $table... " );
@@ -453,7 +453,7 @@ abstract class DatabaseUpdater {
         * @param $fullpath Boolean Whether to treat $patch path as a relative or not
         */
        protected function dropField( $table, $field, $patch, $fullpath = false ) {
-               if ( $this->db->fieldExists( $table, $field ) ) {
+               if ( $this->db->fieldExists( $table, $field, __METHOD__ ) ) {
                        $this->output( "Table $table contains $field field. Dropping... " );
                        $this->applyPatch( $patch, $fullpath );
                        $this->output( "ok\n" );
@@ -471,7 +471,7 @@ abstract class DatabaseUpdater {
         * @param $fullpath Boolean: Whether to treat $patch path as a relative or not
         */
        protected function dropIndex( $table, $index, $patch, $fullpath = false ) {
-               if ( $this->db->indexExists( $table, $index ) ) {
+               if ( $this->db->indexExists( $table, $index, __METHOD__ ) ) {
                        $this->output( "Dropping $index key from table $table... " );
                        $this->applyPatch( $patch, $fullpath );
                        $this->output( "ok\n" );
@@ -507,7 +507,7 @@ abstract class DatabaseUpdater {
                $updateKey = "$table-$field-$patch";
                if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
                        $this->output( "...$table table does not exist, skipping modify field patch\n" );
-               } elseif ( !$this->db->fieldExists( $table, $field ) ) {
+               } elseif ( !$this->db->fieldExists( $table, $field, __METHOD__ ) ) {
                        $this->output( "...$field field does not exist in $table table, skipping modify field patch\n" );
                } elseif( $this->updateRowExists( $updateKey ) ) {
                        $this->output( "...$field in table $table already modified by patch $patch\n" );
index 1e323f2..c873da4 100644 (file)
@@ -583,7 +583,7 @@ class MysqlUpdater extends DatabaseUpdater {
                $this->output( "ok\n" );
 
                if ( !$this->db->tableExists( 'user_rights', __METHOD__ ) ) {
-                       if ( $this->db->fieldExists( 'user', 'user_rights' ) ) {
+                       if ( $this->db->fieldExists( 'user', 'user_rights', __METHOD__ ) ) {
                                $this->output( "Upgrading from a 1.3 or older database? Breaking out user_rights for conversion..." );
                                $this->db->applyPatch( 'patch-user_rights.sql' );
                                $this->output( "ok\n" );
@@ -762,7 +762,7 @@ class MysqlUpdater extends DatabaseUpdater {
        protected function doMaybeProfilingMemoryUpdate() {
                if ( !$this->db->tableExists( 'profiling', __METHOD__ ) ) {
                        // Simply ignore
-               } elseif ( $this->db->fieldExists( 'profiling', 'pf_memory' ) ) {
+               } elseif ( $this->db->fieldExists( 'profiling', 'pf_memory', __METHOD__ ) ) {
                        $this->output( "...profiling table has pf_memory field.\n" );
                } else {
                        $this->output( "Adding pf_memory field to table profiling..." );
@@ -793,7 +793,7 @@ class MysqlUpdater extends DatabaseUpdater {
        }
 
        protected function renameEuWikiId() {
-               if ( $this->db->fieldExists( 'external_user', 'eu_local_id' ) ) {
+               if ( $this->db->fieldExists( 'external_user', 'eu_local_id', __METHOD__ ) ) {
                        $this->output( "...eu_wiki_id already renamed to eu_local_id.\n" );
                        return;
                }
index 2520a0f..509bf62 100644 (file)
@@ -73,7 +73,7 @@ class SqliteUpdater extends DatabaseUpdater {
 
        protected function sqliteInitialIndexes() {
                // initial-indexes.sql fails if the indexes are already present, so we perform a quick check if our database is newer.
-               if ( $this->updateRowExists( 'initial_indexes' ) || $this->db->indexExists( 'user', 'user_name' ) ) {
+               if ( $this->updateRowExists( 'initial_indexes' ) || $this->db->indexExists( 'user', 'user_name', __METHOD__ ) ) {
                        $this->output( "...have initial indexes\n" );
                        return;
                }
index c425db7..5d76f85 100644 (file)
@@ -37,7 +37,7 @@ class ConvertUserOptions extends Maintenance {
                $id = 0;
                $dbw = wfGetDB( DB_MASTER );
 
-               if ( !$dbw->fieldExists( 'user', 'user_options ' ) ) {
+               if ( !$dbw->fieldExists( 'user', 'user_options', __METHOD__ ) ) {
                        $this->output( "No user_options field in the user table. Nothing to migrate..." );
                        return;
                }
index 04606c7..494e0a7 100644 (file)
@@ -112,7 +112,7 @@ class RebuildTextIndex extends Maintenance {
         */
        private function dropMysqlTextIndex() {
                $searchindex = $this->db->tableName( 'searchindex' );
-               if ( $this->db->indexExists( 'searchindex', 'si_title' ) ) {
+               if ( $this->db->indexExists( 'searchindex', 'si_title', __METHOD__ ) ) {
                        $this->output( "Dropping index...\n" );
                        $sql = "ALTER TABLE $searchindex DROP INDEX si_title, DROP INDEX si_text";
                        $this->db->query( $sql, __METHOD__ );
index 5d56e62..9bcfd6a 100644 (file)
@@ -121,8 +121,8 @@ class DbTestPreviewer extends TestRecorder  {
        function start() {
                parent::start();
 
-               if ( ! $this->db->tableExists( 'testrun' )
-                       or ! $this->db->tableExists( 'testitem' ) )
+               if ( ! $this->db->tableExists( 'testrun', __METHOD__ )
+                       || ! $this->db->tableExists( 'testitem', __METHOD__ ) )
                {
                        print "WARNING> `testrun` table not found in database.\n";
                        $this->prevRun = false;
@@ -305,7 +305,7 @@ class DbTestRecorder extends DbTestPreviewer  {
                $this->db->begin();
 
                if ( ! $this->db->tableExists( 'testrun' )
-                       or ! $this->db->tableExists( 'testitem' ) )
+                       || ! $this->db->tableExists( 'testitem' ) )
                {
                        print "WARNING> `testrun` table not found in database. Trying to create table.\n";
                        $this->db->sourceFile( $this->db->patchPath( 'patch-testrun.sql' ) );