$this->addOption( 'multiversiononly', "Calculate only for files with several versions" );
$this->addOption( 'method', "Use 'pipe' to pipe to mysql command line,\n" .
"\t\tdefault uses Database class", false, true );
- $this->addOption( 'file', 'Fix for a specific file, without File: namespace prefixed', false, true );
+ $this->addOption(
+ 'file',
+ 'Fix for a specific file, without File: namespace prefixed',
+ false,
+ true
+ );
}
protected function getUpdateKey() {
* @ingroup Maintenance
*/
class PopulateLogSearch extends LoggedUpdateMaintenance {
- static $tableMap = array( 'rev' => 'revision', 'fa' => 'filearchive', 'oi' => 'oldimage', 'ar' => 'archive' );
+ private static $tableMap = array(
+ 'rev' => 'revision',
+ 'fa' => 'filearchive',
+ 'oi' => 'oldimage',
+ 'ar' => 'archive'
+ );
public function __construct() {
parent::__construct();
# If there are none, check the the highest ID with a lower timestamp
if ( !$previousID ) {
# Get the highest older timestamp
- $lastTimestamp = $db->selectField( 'revision', 'rev_timestamp',
- array( 'rev_page' => $row->rev_page, "rev_timestamp < " . $db->addQuotes( $row->rev_timestamp ) ),
+ $lastTimestamp = $db->selectField(
+ 'revision',
+ 'rev_timestamp',
+ array(
+ 'rev_page' => $row->rev_page,
+ "rev_timestamp < " . $db->addQuotes( $row->rev_timestamp )
+ ),
__METHOD__,
- array( 'ORDER BY' => 'rev_timestamp DESC' ) );
+ array( 'ORDER BY' => 'rev_timestamp DESC' )
+ );
# If there is one, let the highest rev ID win
if ( $lastTimestamp ) {
$previousID = $db->selectField( 'revision', 'rev_id',
* @ingroup Maintenance
*/
-require_once dirname( __FILE__ ) . '/Maintenance.php';
+require_once __DIR__ . '/Maintenance.php';
/**
* Maintenance script to populate the rc_source field.
class PopulateRecentChangesSource extends LoggedUpdateMaintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Populates rc_source field of the recentchanges table with the data in rc_type.";
+ $this->mDescription =
+ "Populates rc_source field of the recentchanges table with the data in rc_type.";
$this->setBatchSize( 100 );
}
$this->output( "Populating ar_len column\n" );
$ar = $this->doLenUpdates( 'archive', 'ar_id', 'ar', Revision::selectArchiveFields() );
- $this->output( "rev_len and ar_len population complete [$rev revision rows, $ar archive rows].\n" );
+ $this->output( "rev_len and ar_len population complete "
+ . "[$rev revision rows, $ar archive rows].\n" );
return true;
}
$this->output( "Populating ar_sha1 column legacy rows\n" );
$ac += $this->doSha1LegacyUpdates();
- $this->output( "rev_sha1 and ar_sha1 population complete [$rc revision rows, $ac archive rows].\n" );
+ $this->output( "rev_sha1 and ar_sha1 population complete "
+ . "[$rc revision rows, $ac archive rows].\n" );
return true;
}
try {
$this->mPreprocessor->preprocessToObj( strval( $content->getNativeData() ), 0 );
} catch ( Exception $e ) {
- $this->error( "Caught exception " . $e->getMessage() . " in " . $rev->getTitle()->getPrefixedText() );
+ $this->error( "Caught exception " . $e->getMessage() . " in "
+ . $rev->getTitle()->getPrefixedText() );
}
}
}
// public $outputTypes = array( 'OT_HTML', 'OT_WIKI', 'OT_PREPROCESS' );
public $entryPoints = array( 'testSrvus', 'testPst', 'testPreprocess' );
public $verbose = false;
- static $currentTest = false;
+
+ private static $currentTest = false;
function execute() {
if ( !file_exists( 'results' ) ) {
$options = ParserOptions::newFromUser( $wgUser );
$options->setTemplateCallback( array( $this, 'templateHook' ) );
$options->setTimestamp( wfTimestampNow() );
- $this->output = call_user_func( array( $wgParser, $this->entryPoint ), $this->mainText, $this->title, $options );
+ $this->output = call_user_func(
+ array( $wgParser, $this->entryPoint ),
+ $this->mainText,
+ $this->title,
+ $options
+ );
+
return $this->output;
}
$s = "Title: " . $this->title->getPrefixedDBkey() . "\n" .
// "Output type: {$this->outputType}\n" .
"Entry point: {$this->entryPoint}\n" .
- "User: " . ( $this->fancySig ? 'fancy' : 'no-fancy' ) . ' ' . var_export( $this->nickname, true ) . "\n" .
+ "User: " . ( $this->fancySig ? 'fancy' : 'no-fancy' ) .
+ ' ' . var_export( $this->nickname, true ) . "\n" .
"Main text: " . var_export( $this->mainText, true ) . "\n";
foreach ( $this->templates as $titleText => $template ) {
$finalTitle = $template['finalTitle'];
}
}
$s .= "Output: " . var_export( $this->output, true ) . "\n";
+
return $s;
}
}
# Count things
$this->output( "Checking current edits..." );
- $res = $dbw->select( 'revision', 'COUNT(*) AS count', $this->userConditions( $from, 'rev_user', 'rev_user_text' ), __METHOD__ );
+ $res = $dbw->select(
+ 'revision',
+ 'COUNT(*) AS count',
+ $this->userConditions( $from, 'rev_user', 'rev_user_text' ),
+ __METHOD__
+ );
$row = $dbw->fetchObject( $res );
$cur = $row->count;
$this->output( "found {$cur}.\n" );
$this->output( "Checking deleted edits..." );
- $res = $dbw->select( 'archive', 'COUNT(*) AS count', $this->userConditions( $from, 'ar_user', 'ar_user_text' ), __METHOD__ );
+ $res = $dbw->select(
+ 'archive',
+ 'COUNT(*) AS count',
+ $this->userConditions( $from, 'ar_user', 'ar_user_text' ),
+ __METHOD__
+ );
$row = $dbw->fetchObject( $res );
$del = $row->count;
$this->output( "found {$del}.\n" );
# Don't count recent changes if we're not supposed to
if ( $rc ) {
$this->output( "Checking recent changes..." );
- $res = $dbw->select( 'recentchanges', 'COUNT(*) AS count', $this->userConditions( $from, 'rc_user', 'rc_user_text' ), __METHOD__ );
+ $res = $dbw->select(
+ 'recentchanges',
+ 'COUNT(*) AS count',
+ $this->userConditions( $from, 'rc_user', 'rc_user_text' ),
+ __METHOD__
+ );
$row = $dbw->fetchObject( $res );
$rec = $row->count;
$this->output( "found {$rec}.\n" );
* @return array
*/
private function userConditions( &$user, $idfield, $utfield ) {
- return $user->getId() ? array( $idfield => $user->getId() ) : array( $utfield => $user->getName() );
+ return $user->getId()
+ ? array( $idfield => $user->getId() )
+ : array( $utfield => $user->getName() );
}
/**
public function execute() {
// Rebuild the text index
if ( wfGetDB( DB_SLAVE )->getType() != 'postgres' ) {
- $this->output( "** Rebuilding fulltext search index (if you abort this will break searching; run this script again to fix):\n" );
+ $this->output( "** Rebuilding fulltext search index (if you abort "
+ . "this will break searching; run this script again to fix):\n" );
$rebuildText = $this->runChild( 'RebuildTextIndex', 'rebuildtextindex.php' );
$rebuildText->execute();
}
$rebuildRC->execute();
// Rebuild link tables
- $this->output( "\n\n** Rebuilding links tables -- this can take a long time. It should be safe to abort via ctrl+C if you get bored.\n" );
+ $this->output( "\n\n** Rebuilding links tables -- this can take a long time. "
+ . "It should be safe to abort via ctrl+C if you get bored.\n" );
$rebuildLinks = $this->runChild( 'RefreshLinks', 'refreshLinks.php' );
$rebuildLinks->execute();