'rc_this_oldid' => 'rev_id',
'rc_last_oldid' => 0, // is this ok?
'rc_type' => $dbw->conditional( 'page_is_new != 0', RC_NEW, RC_EDIT ),
- 'rc_source' => $dbw->conditional( 'page_is_new != 0', $dbw->addQuotes( RecentChange::SRC_NEW ), $dbw->addQuotes( RecentChange::SRC_EDIT ) ),
+ 'rc_source' => $dbw->conditional(
+ 'page_is_new != 0',
+ $dbw->addQuotes( RecentChange::SRC_NEW ),
+ $dbw->addQuotes( RecentChange::SRC_EDIT )
+ ),
'rc_deleted' => 'rev_deleted'
), array(
'rev_timestamp > ' . $dbw->addQuotes( $dbw->timestamp( $cutoff ) ),
$cutoff = time() - $wgRCMaxAge;
list( $logging, $page ) = $dbw->tableNamesN( 'logging', 'page' );
- $dbw->insertSelect( 'recentchanges', array( 'user', "$logging LEFT JOIN $page ON (log_namespace=page_namespace AND log_title=page_title)" ),
+ $dbw->insertSelect(
+ 'recentchanges',
+ array(
+ 'user',
+ "$logging LEFT JOIN $page ON (log_namespace=page_namespace AND log_title=page_title)"
+ ),
array(
'rc_timestamp' => 'log_timestamp',
'rc_user' => 'log_user',
$dbw = wfGetDB( DB_MASTER );
- list( $recentchanges, $usergroups, $user ) = $dbw->tableNamesN( 'recentchanges', 'user_groups', 'user' );
+ list( $recentchanges, $usergroups, $user ) =
+ $dbw->tableNamesN( 'recentchanges', 'user_groups', 'user' );
$botgroups = User::getGroupsWithPermission( 'bot' );
$autopatrolgroups = $wgUseRCPatrol ? User::getGroupsWithPermission( 'autopatrol' ) : array();
$this->db = wfGetDB( DB_MASTER );
if ( $this->db->getType() == 'sqlite' ) {
if ( !DatabaseSqlite::getFulltextSearchModule() ) {
- $this->error( "Your version of SQLite module for PHP doesn't support full-text search (FTS3).\n", true );
+ $this->error( "Your version of SQLite module for PHP doesn't "
+ . "support full-text search (FTS3).\n", true );
}
if ( !$this->db->checkForEnabledSearch() ) {
- $this->error( "Your database schema is not configured for full-text search support. Run update.php.\n", true );
+ $this->error( "Your database schema is not configured for "
+ . "full-text search support. Run update.php.\n", true );
}
}
$this->mDescription = 'Script to update image metadata records';
$this->setBatchSize( 200 );
- $this->addOption( 'force', 'Reload metadata from file even if the metadata looks ok', false, false, 'f' );
- $this->addOption( 'broken-only', 'Only fix really broken records, leave old but still compatible records alone.' );
- $this->addOption( 'verbose', 'Output extra information about each upgraded/non-upgraded file.', false, false, 'v' );
+ $this->addOption(
+ 'force',
+ 'Reload metadata from file even if the metadata looks ok',
+ false,
+ false,
+ 'f'
+ );
+ $this->addOption(
+ 'broken-only',
+ 'Only fix really broken records, leave old but still compatible records alone.'
+ );
+ $this->addOption(
+ 'verbose',
+ 'Output extra information about each upgraded/non-upgraded file.',
+ false,
+ false,
+ 'v'
+ );
$this->addOption( 'start', 'Name of file to start with', false, true );
$this->addOption( 'end', 'Name of file to end with', false, true );
- $this->addOption( 'mime', '(Inefficient!) Only refresh files with this mime type. Can accept wild-card image/*', false, true );
- $this->addOption( 'metadata-contains', '(Inefficient!) Only refresh files where the img_metadata field contains this string. Can be used if its known a specific property was being extracted incorrectly.', false, true );
+ $this->addOption(
+ 'mime',
+ '(Inefficient!) Only refresh files with this mime type. Can accept wild-card image/*',
+ false,
+ true
+ );
+ $this->addOption(
+ 'metadata-contains',
+ '(Inefficient!) Only refresh files where the img_metadata field '
+ . 'contains this string. Can be used if its known a specific '
+ . 'property was being extracted incorrectly.',
+ false,
+ true
+ );
}
$total = $upgraded + $leftAlone;
if ( $force ) {
- $this->output( "\nFinished refreshing file metadata for $total files. $upgraded needed to be refreshed, $leftAlone did not need to be but were refreshed anyways, and $error refreshes were suspicious.\n" );
+ $this->output( "\nFinished refreshing file metadata for $total files. "
+ . "$upgraded needed to be refreshed, $leftAlone did not need to "
+ . "be but were refreshed anyways, and $error refreshes were suspicious.\n" );
} else {
- $this->output( "\nFinished refreshing file metadata for $total files. $upgraded were refreshed, $leftAlone were already up to date, and $error refreshes were suspicious.\n" );
+ $this->output( "\nFinished refreshing file metadata for $total files. "
+ . "$upgraded were refreshed, $leftAlone were already up to date, "
+ . "and $error refreshes were suspicious.\n" );
}
}
}
$touchedSeconds = 86400 * $touched;
foreach ( $res as $row ) {
- # Check the account, but ignore it if it's within a $excludedGroups group or if it's touched within the $touchedSeconds seconds.
+ # Check the account, but ignore it if it's within a $excludedGroups
+ # group or if it's touched within the $touchedSeconds seconds.
$instance = User::newFromId( $row->user_id );
if ( count( array_intersect( $instance->getEffectiveGroups(), $excludedGroups ) ) == 0
&& $this->isInactiveAccount( $row->user_id, true )
$this->output( "done.\n" );
# Update the site_stats.ss_users field
$users = $dbw->selectField( 'user', 'COUNT(*)', array(), __METHOD__ );
- $dbw->update( 'site_stats', array( 'ss_users' => $users ), array( 'ss_row_id' => 1 ), __METHOD__ );
+ $dbw->update(
+ 'site_stats',
+ array( 'ss_users' => $users ),
+ array( 'ss_row_id' => 1 ),
+ __METHOD__
+ );
} elseif ( $count > 0 ) {
$this->output( "\nRun the script again with --delete to remove them from the database.\n" );
}
class ResetUserTokens extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Reset the user_token of all users on the wiki. Note that this may log some of them out.";
+ $this->mDescription =
+ "Reset the user_token of all users on the wiki. Note that this may log some of them out.";
$this->addOption( 'nowarn', "Hides the 5 seconds warning", false, false );
- $this->addOption( 'nulls', 'Only reset tokens that are currently null (string of \x00\'s)', false, false );
+ $this->addOption(
+ 'nulls',
+ 'Only reset tokens that are currently null (string of \x00\'s)',
+ false,
+ false
+ );
$this->setBatchSize( 1000 );
}
if ( !$this->getOption( 'nowarn' ) ) {
if ( $this->nullsOnly ) {
- $this->output( "The script is about to reset the user_token for USERS WITH NULL TOKENS in the database.\n" );
+ $this->output( "The script is about to reset the user_token "
+ . "for USERS WITH NULL TOKENS in the database.\n" );
} else {
$this->output( "The script is about to reset the user_token for ALL USERS in the database.\n" );
$this->output( "This may log some of them out and is not necessary unless you believe your\n" );
$this->output( "user table has been compromised.\n" );
}
$this->output( "\n" );
- $this->output( "Abort with control-c in the next five seconds (skip this countdown with --nowarn) ... " );
+ $this->output( "Abort with control-c in the next five seconds "
+ . "(skip this countdown with --nowarn) ... " );
wfCountDown( 5 );
}
class RollbackEdits extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Rollback all edits by a given user or IP provided they're the most recent edit";
- $this->addOption( 'titles', 'A list of titles, none means all titles where the given user is the most recent', false, true );
+ $this->mDescription =
+ "Rollback all edits by a given user or IP provided they're the most recent edit";
+ $this->addOption(
+ 'titles',
+ 'A list of titles, none means all titles where the given user is the most recent',
+ false,
+ true
+ );
$this->addOption( 'user', 'A user or IP to rollback all edits for', true, true );
$this->addOption( 'summary', 'Edit summary to use', false, true );
$this->addOption( 'bot', 'Mark the edits as bot' );
class BatchedQueryRunner extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Run a query repeatedly until it affects 0 rows, and wait for slaves in between.\n" .
+ $this->mDescription =
+ "Run a query repeatedly until it affects 0 rows, and wait for slaves in between.\n" .
"NOTE: You need to set a LIMIT clause yourself.";
}
$backoffs = $this->loadBackoffs(); // map of (type => UNIX expiry)
$startingBackoffs = $backoffs; // avoid unnecessary writes
- $backoffExpireFunc = function( $t ) { return $t > time(); };
+ $backoffExpireFunc = function ( $t ) {
+ return $t > time();
+ };
$jobsRun = 0; // counter
$flags = JobQueueGroup::USE_CACHE;
$total = $hits + $expired + $absent + $stub;
if ( $total ) {
$this->output( sprintf( "hits: %-10d %6.2f%%\n", $hits, $hits / $total * 100 ) );
- $this->output( sprintf( "expired: %-10d %6.2f%%\n", $expired, $expired / $total * 100 ) );
- $this->output( sprintf( "absent: %-10d %6.2f%%\n", $absent, $absent / $total * 100 ) );
+ $this->output( sprintf(
+ "expired: %-10d %6.2f%%\n",
+ $expired,
+ $expired / $total * 100
+ ) );
+ $this->output( sprintf(
+ "absent: %-10d %6.2f%%\n",
+ $absent,
+ $absent / $total * 100
+ ) );
$this->output( sprintf( "stub threshold: %-10d %6.2f%%\n", $stub, $stub / $total * 100 ) );
$this->output( sprintf( "total: %-10d %6.2f%%\n", $total, 100 ) );
} else {
$total = $hits + $misses;
if ( $total ) {
$this->output( sprintf( "hits: %-10d %6.2f%%\n", $hits, $hits / $total * 100 ) );
- $this->output( sprintf( "misses: %-10d %6.2f%%\n", $misses, $misses / $total * 100 ) );
+ $this->output( sprintf(
+ "misses: %-10d %6.2f%%\n",
+ $misses,
+ $misses / $total * 100
+ ) );
$this->output( sprintf( "updates: %-10d\n", $updates ) );
} else {
$this->output( "no statistics available\n" );
$total = $hits + $misses + $uncacheable;
if ( $total ) {
$this->output( sprintf( "hits: %-10d %6.2f%%\n", $hits, $hits / $total * 100 ) );
- $this->output( sprintf( "misses: %-10d %6.2f%%\n", $misses, $misses / $total * 100 ) );
- $this->output( sprintf( "uncacheable: %-10d %6.2f%%\n", $uncacheable, $uncacheable / $total * 100 ) );
+ $this->output( sprintf(
+ "misses: %-10d %6.2f%%\n",
+ $misses,
+ $misses / $total * 100
+ ) );
+ $this->output( sprintf(
+ "uncacheable: %-10d %6.2f%%\n",
+ $uncacheable,
+ $uncacheable / $total * 100
+ ) );
} else {
$this->output( "no statistics available\n" );
}
parent::__construct();
$this->mDescription = "Show number of jobs waiting in master database";
$this->addOption( 'group', 'Show number of jobs per job type' );
- $this->addOption( 'list', 'Show a complete list of all jobs in a machine-readable format, instead of statistics' );
+ $this->addOption(
+ 'list',
+ 'Show a complete list of all jobs in a machine-readable format, instead of statistics'
+ );
}
public function execute() {