Pass in some more , __METHOD__

This commit is contained in:
Sam Reed 2011-11-10 20:44:37 +00:00
parent 9814e6b075
commit 2eda76aec4
6 changed files with 15 additions and 15 deletions

View 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" );

View 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;
}

View 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;
}

View 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;
}

View 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__ );

View 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' ) );