From 2eda76aec4da62ca033778b86730bdef14a67d5d Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Thu, 10 Nov 2011 20:44:37 +0000 Subject: [PATCH] Pass in some more , __METHOD__ --- includes/installer/DatabaseUpdater.php | 12 ++++++------ includes/installer/MysqlUpdater.php | 6 +++--- includes/installer/SqliteUpdater.php | 2 +- maintenance/convertUserOptions.php | 2 +- maintenance/rebuildtextindex.php | 2 +- tests/testHelpers.inc | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index 4f6e7a9dd6..58c1f4f499 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -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" ); diff --git a/includes/installer/MysqlUpdater.php b/includes/installer/MysqlUpdater.php index 1e323f2d51..c873da4c48 100644 --- a/includes/installer/MysqlUpdater.php +++ b/includes/installer/MysqlUpdater.php @@ -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; } diff --git a/includes/installer/SqliteUpdater.php b/includes/installer/SqliteUpdater.php index 2520a0f648..509bf62a9e 100644 --- a/includes/installer/SqliteUpdater.php +++ b/includes/installer/SqliteUpdater.php @@ -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; } diff --git a/maintenance/convertUserOptions.php b/maintenance/convertUserOptions.php index c425db7666..5d76f85e2c 100644 --- a/maintenance/convertUserOptions.php +++ b/maintenance/convertUserOptions.php @@ -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; } diff --git a/maintenance/rebuildtextindex.php b/maintenance/rebuildtextindex.php index 04606c757c..494e0a7576 100644 --- a/maintenance/rebuildtextindex.php +++ b/maintenance/rebuildtextindex.php @@ -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__ ); diff --git a/tests/testHelpers.inc b/tests/testHelpers.inc index 5d56e62590..9bcfd6ac40 100644 --- a/tests/testHelpers.inc +++ b/tests/testHelpers.inc @@ -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' ) ); -- 2.20.1