* @todo Document
* @param $fix Boolean: whether or not to fix broken entries
* @param $suffix String: suffix to append to renamed articles
+ *
+ * @return bool
*/
private function checkAll( $fix, $suffix = '' ) {
global $wgContLang, $wgNamespaceAliases, $wgCapitalLinks;
* @param $name String
* @param $fix Boolean: whether to fix broken entries
* @param $suffix String: suffix to append to renamed articles
+ * @return bool
*/
private function checkNamespace( $ns, $name, $fix, $suffix = '' ) {
$conflicts = $this->getConflicts( $ns, $name );
/**
* @todo: do this for reals
+ * @param $key
+ * @param $prefix
+ * @param $fix
+ * @param $suffix string
+ * @return bool
*/
private function checkPrefix( $key, $prefix, $fix, $suffix = '' ) {
$this->output( "Checking prefix \"$prefix\" vs namespace $key\n" );
* @param $row Object: row from the page table to fix
* @param $resolvable Boolean
* @param $suffix String: suffix to append to the fixed page
+ * @return bool
*/
private function resolveConflict( $row, $resolvable, $suffix ) {
if ( !$resolvable ) {
* @param $row Object: row from the old broken entry
* @param $table String: table to update
* @param $prefix String: prefix for column name, like page or ar
+ * @return bool
*/
private function resolveConflictOn( $row, $table, $prefix ) {
$this->output( "... resolving on $table... " );
$memcKey = 'jobqueue:dbs:v2';
$pendingDBs = $wgMemc->get( $memcKey );
- // If the cache entry wasn't present, or in 1% of cases otherwise,
+ // If the cache entry wasn't present, or in 1% of cases otherwise,
// regenerate the cache.
if ( !$pendingDBs || mt_rand( 0, 100 ) == 0 ) {
$pendingDBs = $this->getPendingDbs();
$candidates = array_values( $candidates );
$db = $candidates[ mt_rand( 0, count( $candidates ) - 1 ) ];
if ( !$this->checkJob( $type, $db ) ) {
- // This job is not available in the current database. Remove it from
+ // This job is not available in the current database. Remove it from
// the cache.
if ( $type === false ) {
foreach ( $pendingDBs as $type2 => $dbs ) {
/**
* Check if the specified database has a job of the specified type in it.
- * The type may be false to indicate "all".
+ * The type may be false to indicate "all".
+ * @param $type string
+ * @param $dbName string
+ * @return bool
*/
function checkJob( $type, $dbName ) {
$lb = wfGetLB( $dbName );
$t += microtime( true );
$this->output( sprintf( "\nDone %d files in %.1f seconds\n", $numRows, $t ) );
- if ( $file ) {
- return false; // we only updated *some* files, don't log
- } else {
- return true;
- }
+ return !$file; // we only updated *some* files, don't log
}
}
/**
* Get all pages that should be rolled back for a given user
* @param $user String a name to check against rev_user_text
+ * @return array
*/
private function getRollbackTitles( $user ) {
$dbr = wfGetDB( DB_SLAVE );
$this->error( "No query specified. Specify the query as a command line parameter.", true );
$query = $this->getArg();
- $wait = $this->getOption( 'wait', 5 );
$n = 1;
$dbw = wfGetDB( DB_MASTER );
do {
/**
* While we use database connection, this simple lie prevents useless --dbpass and
* --dbuser options from appearing in help message for this script.
+ *
+ * @return int DB constant
*/
public function getDbType() {
return Maintenance::DB_NONE;
}
$maintClass = "SqliteMaintenance";
-require_once( RUN_MAINTENANCE_IF_MAIN );
\ No newline at end of file
+require_once( RUN_MAINTENANCE_IF_MAIN );
function check( $fix = false, $xml = '' ) {
$dbr = wfGetDB( DB_SLAVE );
if ( $fix ) {
- $dbw = wfGetDB( DB_MASTER );
print "Checking, will fix errors if possible...\n";
} else {
print "Checking...\n";
} while( true );
}
- /** @todo document */
+ /**
+ * @todo document
+ * @param $row
+ * @param $extdb
+ * @return bool
+ */
private function compressPage( $row, $extdb ) {
if ( false !== strpos( $row->old_flags, 'gzip' ) || false !== strpos( $row->old_flags, 'object' ) ) {
#print "Already compressed row {$row->old_id}\n";
return true;
}
- /** @todo document */
+ /**
+ * @param $startId
+ * @param $maxChunkSize
+ * @param $beginDate
+ * @param $endDate
+ * @param $extdb string
+ * @param $maxPageId bool|int
+ * @return bool
+ */
private function compressWithConcat( $startId, $maxChunkSize, $beginDate,
$endDate, $extdb = "", $maxPageId = false )
{
/**
* This is based on part of HistoryBlobStub::getText().
* Determine if the text can be retrieved from the row in the normal way.
+ * @param $stub
+ * @param $secondaryRow
+ * @return bool
*/
function isUnbrokenStub( $stub, $secondaryRow ) {
$flags = explode( ',', $secondaryRow->old_flags );
/**
* Make sure the tracking table exists and isn't empty
+ * @return bool
*/
function checkTrackingTable() {
$dbr = wfGetDB( DB_SLAVE );
/**
* Returns the name of the next target cluster
+ * @return string
*/
function getTargetCluster() {
$cluster = next( $this->destClusters );
/**
* Gets a DB master connection for the given external cluster name
+ * @param $cluster string
+ * @return DatabaseBase
*/
function getExtDB( $cluster ) {
$lb = wfGetLBFactory()->getExternalLB( $cluster );
/**
* Add text.
* Returns false if it's ready to commit.
+ * @param $text string
+ * @param $textId
+ * @return bool
*/
function addItem( $text, $textId ) {
if ( !$this->cgz ) {
* @ingroup Maintenance
*/
class FiveUpgrade extends Maintenance {
+
+ /**
+ * @var DatabaseBase
+ */
+ protected $db;
+
function __construct() {
parent::__construct();
/**
* Helper function for copyTable array_filter
+ * @param $x
+ * @return bool
*/
static private function notUpgradeNull( $x ) {
return $x !== MW_UPGRADE_NULL;
* Rename a given image or archived image file to the converted filename,
* leaving a symlink for URL compatibility.
*
- * @param string $oldname pre-conversion filename
- * @param string $basename pre-conversion base filename for dir hashing, if an archive
+ * @param $oldname string pre-conversion filename
+ * @param $subdirCallback string
+ * @param $basename string pre-conversion base filename for dir hashing, if an archive
+ * @return bool|string
* @access private
*/
function renameFile( $oldname, $subdirCallback = 'wfImageDir', $basename = null ) {
}
- /** This is used to check options. Only needed on construction */
+ /**
+ * This is used to check options. Only needed on construction
+ *
+ * @param $opts array
+ * @param $args array
+ *
+ * @return bool
+ */
private function checkOpts( $opts, $args ) {
// The three possible ways to run the script:
$list = isset( $opts['list'] );
return $isValid;
}
- /** load script options in the object */
+ /**
+ * load script options in the object
+ *
+ * @param $opts array
+ * @param $args array
+ *
+ * @return true
+ */
private function initializeOpts( $opts, $args ) {
$this->mQuick = isset( $opts['nowarn'] );
return false;
}
- $this-> { $this->mMode } ( );
-
+ $this->{ $this->mMode } ( );
+ return true;
}
#
}
}
-
- /** Return an array of option names */
+ /**
+ * Return an array of option names
+ * @return array
+ */
public static function getDefaultOptionsNames() {
$def = User::getDefaultOptions();
$ret = array();
return $ret;
}
-
#
# Helper methods
#
exit( 0 );
}
- /** The warning message and countdown */
+ /**
+ * The warning message and countdown
+ * @return bool
+ */
public function warn() {
if ( $this->mQuick ) {