// Show them
foreach ( $fields as $field => $desc ) {
- $this->output( sprintf( "%-{$max_length_desc}s: %{$max_length_value}d\n", $desc, $stats->$field ) );
+ $this->output( sprintf(
+ "%-{$max_length_desc}s: %{$max_length_value}d\n",
+ $desc,
+ $stats->$field
+ ) );
}
}
}
$index = DB_SLAVE;
} else {
$index = null;
- for ( $i = 0; $i < $lb->getServerCount(); ++$i ) {
+ $serverCount = $lb->getServerCount();
+ for ( $i = 0; $i < $serverCount; ++$i ) {
if ( $lb->getServerName( $i ) === $server ) {
$index = $i;
break;
public function __construct() {
parent::__construct();
$this->mDescription = "Performs some operations specific to SQLite database backend";
- $this->addOption( 'vacuum', 'Clean up database by removing deleted pages. Decreases database file size' );
+ $this->addOption(
+ 'vacuum',
+ 'Clean up database by removing deleted pages. Decreases database file size'
+ );
$this->addOption( 'integrity', 'Check database for integrity' );
$this->addOption( 'backup-to', 'Backup database to the given file', false, true );
$this->addOption( 'check-syntax', 'Check SQL file(s) for syntax errors', false, true );
$this->addOption( 'doshared', 'Also update shared tables' );
$this->addOption( 'nopurge', 'Do not purge the objectcache table after updates' );
$this->addOption( 'noschema', 'Only do the updates that are not done during schema updates' );
- $this->addOption( 'schema', 'Output SQL to do the schema updates instead of doing them. Works even when $wgAllowSchemaUpdates is false', false, true );
+ $this->addOption(
+ 'schema',
+ 'Output SQL to do the schema updates instead of doing them. Works '
+ . 'even when $wgAllowSchemaUpdates is false',
+ false,
+ true
+ );
$this->addOption( 'force', 'Override when $wgAllowSchemaUpdates disables this script' );
}
function getDbType() {
/* If we used the class constant PHP4 would give a parser error here */
- return 2 /* Maintenance::DB_ADMIN */;
+ return 2; /* Maintenance::DB_ADMIN */
}
function compatChecks() {
function execute() {
global $wgVersion, $wgLang, $wgAllowSchemaUpdates;
- if ( !$wgAllowSchemaUpdates && !( $this->hasOption( 'force' ) || $this->hasOption( 'schema' ) || $this->hasOption( 'noschema' ) ) ) {
+ if ( !$wgAllowSchemaUpdates
+ && !( $this->hasOption( 'force' )
+ || $this->hasOption( 'schema' )
+ || $this->hasOption( 'noschema' ) )
+ ) {
$this->error( "Do not run update.php on this wiki. If you're seeing this you should\n"
. "probably ask for some help in performing your schema updates or use\n"
. "the --noschema and --schema options to get an SQL file for someone\n"
$this->output( "Depending on the size of your database this may take a while!\n" );
if ( !$this->hasOption( 'quick' ) ) {
- $this->output( "Abort with control-c in the next five seconds (skip this countdown with --quick) ... " );
+ $this->output( "Abort with control-c in the next five seconds "
+ . "(skip this countdown with --quick) ... " );
wfCountDown( 5 );
}
if ( $this->hasOption( 'update' ) ) {
$this->output( "Updating site statistics table... " );
$dbw = wfGetDB( DB_MASTER );
- $dbw->update( 'site_stats', array( 'ss_good_articles' => $result ), array( 'ss_row_id' => 1 ), __METHOD__ );
+ $dbw->update(
+ 'site_stats',
+ array( 'ss_good_articles' => $result ),
+ array( 'ss_row_id' => 1 ),
+ __METHOD__
+ );
$this->output( "done.\n" );
} else {
- $this->output( "To update the site statistics table, run the script with the --update option.\n" );
+ $this->output( "To update the site statistics table, run the script "
+ . "with the --update option.\n" );
}
}
}
parent::__construct();
$this->mDescription = "Script to normalize double-byte latin UTF-8 characters";
$this->addOption( 'q', 'quiet', false, true );
- $this->addOption( 'l', 'How long the searchindex and revision tables will be locked for', false, true );
+ $this->addOption(
+ 'l',
+ 'How long the searchindex and revision tables will be locked for',
+ false,
+ true
+ );
}
public function getDbType() {
while ( $blockEnd <= $end ) {
$this->output( "...doing page_id from $blockStart to $blockEnd\n" );
$cond = "page_id BETWEEN $blockStart AND $blockEnd AND page_restrictions !=''";
- $res = $db->select( 'page', array( 'page_id', 'page_namespace', 'page_restrictions' ), $cond, __METHOD__ );
+ $res = $db->select(
+ 'page',
+ array( 'page_id', 'page_namespace', 'page_restrictions' ),
+ $cond,
+ __METHOD__
+ );
$batch = array();
foreach ( $res as $row ) {
$oldRestrictions = array();
// Kill any broken rows from previous imports
$db->delete( 'page_restrictions', array( 'pr_level' => '' ) );
// Kill other invalid rows
- $db->deleteJoin( 'page_restrictions', 'page', 'pr_page', 'page_id', array( 'page_namespace' => NS_MEDIAWIKI ) );
+ $db->deleteJoin(
+ 'page_restrictions',
+ 'page',
+ 'pr_page',
+ 'page_id',
+ array( 'page_namespace' => NS_MEDIAWIKI )
+ );
$this->output( "...Done!\n" );
}
}
$this->mDescription = "Script for periodic off-peak updating of the search index";
$this->addOption( 's', 'starting timestamp', false, true );
$this->addOption( 'e', 'Ending timestamp', false, true );
- $this->addOption( 'p', 'File for saving/loading timestamps, searchUpdate.WIKI_ID.pos by default', false, true );
- $this->addOption( 'l', 'How long the searchindex and revision tables will be locked for', false, true );
+ $this->addOption(
+ 'p',
+ 'File for saving/loading timestamps, searchUpdate.WIKI_ID.pos by default',
+ false,
+ true
+ );
+ $this->addOption(
+ 'l',
+ 'How long the searchindex and revision tables will be locked for',
+ false,
+ true
+ );
}
public function getDbType() {
if ( $this->reassigned > 0 ) {
if ( $doDelete ) {
- $this->out( "$this->reassigned duplicate accounts had edits reassigned to a canonical record id.\n" );
+ $this->out( "$this->reassigned duplicate accounts had edits "
+ . "reassigned to a canonical record id.\n" );
} else {
$this->out( "$this->reassigned duplicate accounts need to have edits reassigned.\n" );
}
if ( $this->trimmed > 0 ) {
if ( $doDelete ) {
- $this->out( "$this->trimmed duplicate user records were deleted from " . wfWikiID() . ".\n" );
+ $this->out( "$this->trimmed duplicate user records were deleted from "
+ . wfWikiID() . ".\n" );
} else {
- $this->out( "$this->trimmed duplicate user accounts were found on " . wfWikiID() . " which can be removed safely.\n" );
+ $this->out( "$this->trimmed duplicate user accounts were found on "
+ . wfWikiID() . " which can be removed safely.\n" );
}
}
$userValue = $user->getOption( $this->mAnOption );
if ( $userValue <> $defaultOptions[$this->mAnOption] ) {
+ // @codingStandardsIgnoreStart Ignore silencing errors is discouraged warning
@$ret[$this->mAnOption][$userValue]++;
+ // @codingStandardsIgnoreEnd
}
} else {
foreach ( $defaultOptions as $name => $defaultValue ) {
$userValue = $user->getOption( $name );
if ( $userValue <> $defaultValue ) {
+ // @codingStandardsIgnoreStart Ignore silencing errors is discouraged warning
@$ret[$name][$userValue]++;
+ // @codingStandardsIgnoreEnd
}
}
}
if ( $curValue == $this->mOldValue ) {
if ( !$this->mQuiet ) {
- print "Setting {$this->mAnOption} for $username from '{$this->mOldValue}' to '{$this->mNewValue}'): ";
+ print "Setting {$this->mAnOption} for $username from '{$this->mOldValue}' " .
+ "to '{$this->mNewValue}'): ";
}
// Change value