$db = wfGetDB( DB_MASTER );
if ( !$db->tableExists( 'externallinks' ) ) {
$this->error( "externallinks table does not exist" );
+
return false;
}
$this->output( "Fixing protocol-relative entries in the externallinks table...\n" );
);
}
$this->output( "Done, $count rows updated.\n" );
+
return true;
}
}
}
}
$this->output( "\n" );
+
return $desync;
}
if ( !$found ) {
$this->output( "page_id $pageID seems fine\n" );
$dbw->commit( __METHOD__ );
+
return;
}
if ( $sign == 0 || $sign == $expectedSign ) {
// Monotonic change
$lastNormal = $timestamp;
- ++ $numGoodRevs;
+ ++$numGoodRevs;
continue;
} elseif ( abs( $delta ) <= $grace ) {
// Non-monotonic change within grace interval
- ++ $numGoodRevs;
+ ++$numGoodRevs;
continue;
} else {
// Non-monotonic change larger than grace interval
$numBadRevs = count( $badRevs );
if ( $numBadRevs > $numGoodRevs ) {
$this->error(
- "The majority of revisions in the search interval are marked as bad.
+ "The majority of revisions in the search interval are marked as bad.
Are you sure the offset ($offset) has the right sign? Positive means the clock
was incorrectly set forward, negative means the clock was incorrectly set back.
if ( $this->hasOption( 'shim-only' ) ) {
$this->shimOnly( $phpfile, $jsondir );
+
return;
}
$jsondir = str_replace( '\\', '/', $jsondir );
$shim = str_replace( '{{OUT}}', $jsondir, $shim );
$shim = str_replace( '{{FUNC}}', 'wfJsonI18nShim' . wfRandomString( 16 ), $shim );
+
return $shim;
}
protected function getAuthorsFromComment( $comment ) {
$matches = null;
preg_match_all( '/@author (.*?)$/m', $comment, $matches );
+
return $matches && $matches[1] ? $matches[1] : array();
}
}
global $wgSitemapNamespaces;
if ( is_array( $wgSitemapNamespaces ) ) {
$this->namespaces = $wgSitemapNamespaces;
+
return;
}
$fns = $wgContLang->getFormattedNsText( $namespace );
$this->output( "$namespace ($fns)\n" );
- $skippedRedirects = 0; // Number of redirects skipped for that namespace
+ $skippedRedirects = 0; // Number of redirects skipped for that namespace
foreach ( $res as $row ) {
if ( $this->skipRedirects && $row->page_is_redirect ) {
$skippedRedirects++;
throw new MWException( __METHOD__
. " error opening file $file with flags $flags. Check permissions?" );
}
+
return $resource;
}
*/
function sitemapFilename( $namespace, $count ) {
$ext = $this->compress ? '.gz' : '';
+
return "sitemap-{$this->identifier}-NS_$namespace-$count.xml$ext";
}
$format = strtolower( $this->getOption( 'format', 'PHP' ) );
$validFormat = in_array( $format, self::$outFormats );
- if ( ! $validFormat ) {
+ if ( !$validFormat ) {
$this->error( "--format set to an unrecognized format", 0 );
$error_out = true;
}
public function finalSetup() {
parent::finalSetup();
- $this->regex = $this->getOption( 'regex' ) ?: $this->getOption( 'iregex' );
+ $this->regex = $this->getOption( 'regex' ) ? : $this->getOption( 'iregex' );
if ( $this->regex ) {
$this->regex = '/' . $this->regex . '/';
if ( $this->hasOption( 'iregex' ) ) {
- $this->regex .= 'i'; # case insensitive regex
+ $this->regex .= 'i'; # case insensitive regex
}
}
$res = array();
# Sane default: dump any wg / wmg variable
- if ( ! $this->regex && ! $this->getOption( 'settings' ) ) {
+ if ( !$this->regex && !$this->getOption( 'settings' ) ) {
$this->regex = '/^wm?g/';
}
protected function formatVarDump( $res ) {
$ret = '';
foreach ( $res as $key => $value ) {
- ob_start(); # intercept var_dump() output
+ ob_start(); # intercept var_dump() output
print "\${$key} = ";
var_dump( $value );
# grab var_dump() output and discard it from the output buffer
return false;
}
}
+
return true;
} elseif ( is_scalar( $value ) ) {
return true;
}
+
return false;
}
}
$this->addOption( "group", "Query group to check specifically" );
$this->mDescription = "Report the hostname of a slave server";
}
+
public function execute() {
global $wgAllDBsAreLocalhost;
if ( $wgAllDBsAreLocalhost ) {
function setNsfilter( array $namespaces ) {
if ( count( $namespaces ) == 0 ) {
$this->nsFilter = false;
+
return;
}
$this->nsFilter = array_unique( array_map( array( $this, 'getNsIndex' ), $namespaces ) );
echo wfBacktrace();
$this->error( "Cannot get namespace of object in " . __METHOD__, true );
}
+
return is_array( $this->nsFilter ) && !in_array( $ns, $this->nsFilter );
}
$title = $rev->getTitle();
if ( !$title ) {
$this->progress( "Got bogus revision with null title!" );
+
return;
}
// bluuuh hack
// call_user_func( $this->uploadCallback, $revision );
$dbw = wfGetDB( DB_MASTER );
+
return $dbw->deadlockLoop( array( $revision, 'importUpload' ) );
}
}
}
$file = fopen( $filename, 'rt' );
+
return $this->importFromHandle( $file );
}
if ( self::posix_isatty( $file ) ) {
$this->maybeHelp( true );
}
+
return $this->importFromHandle( $file );
}
$files = array_merge( $files, findFiles( $dir . '/' . $file, $exts, true ) );
}
}
+
return $files;
} else {
return array();
*/
function splitFilename( $filename ) {
$parts = explode( '.', $filename );
- $ext = $parts[ count( $parts ) - 1 ];
- unset( $parts[ count( $parts ) - 1 ] );
+ $ext = $parts[count( $parts ) - 1];
+ unset( $parts[count( $parts ) - 1] );
$fname = implode( '.', $parts );
+
return array( $fname, $ext );
}
}
if ( $doProtect ) {
- # Protect the file
- echo "\nWaiting for slaves...\n";
- // Wait for slaves.
- sleep( 2.0 ); # Why this sleep?
- wfWaitForSlaves();
-
- echo "\nSetting image restrictions ... ";
-
- $cascade = false;
- $restrictions = array();
- foreach ( $title->getRestrictionTypes() as $type ) {
- $restrictions[$type] = $protectLevel;
- }
+ # Protect the file
+ echo "\nWaiting for slaves...\n";
+ // Wait for slaves.
+ sleep( 2.0 ); # Why this sleep?
+ wfWaitForSlaves();
+
+ echo "\nSetting image restrictions ... ";
+
+ $cascade = false;
+ $restrictions = array();
+ foreach ( $title->getRestrictionTypes() as $type ) {
+ $restrictions[$type] = $protectLevel;
+ }
- $page = WikiPage::factory( $title );
- $status = $page->doUpdateRestrictions( $restrictions, array(), $cascade, '', $user );
- echo ( $status->isOK() ? 'done' : 'failed' ) . "\n";
+ $page = WikiPage::factory( $title );
+ $status = $page->doUpdateRestrictions( $restrictions, array(), $cascade, '', $user );
+ echo ( $status->isOK() ? 'done' : 'failed' ) . "\n";
}
-
} else {
echo "failed. (at recordUpload stage)\n";
$svar = 'failed';
# Print out some statistics
echo "\n";
- foreach ( array( 'count' => 'Found', 'limit' => 'Limit', 'ignored' => 'Ignored',
- 'added' => 'Added', 'skipped' => 'Skipped', 'overwritten' => 'Overwritten',
- 'failed' => 'Failed' ) as $var => $desc ) {
+ foreach (
+ array(
+ 'count' => 'Found',
+ 'limit' => 'Limit',
+ 'ignored' => 'Ignored',
+ 'added' => 'Added',
+ 'skipped' => 'Skipped',
+ 'overwritten' => 'Overwritten',
+ 'failed' => 'Failed'
+ ) as $var => $desc
+ ) {
if ( $$var > 0 ) {
echo "{$desc}: {$$var}\n";
}
}
-
} else {
echo "No suitable files could be found for import.\n";
}
$content = ContentHandler::makeContent( $text, $wikiPage->getTitle() );
$wikiPage->doEditContent( $content, "Importing from $url", 0, false, $user );
}
-
}
protected function fetchScriptList() {
$data = array(
'action' => 'query',
- 'format' => 'php',//'json',
+ 'format' => 'php', //'json',
'list' => 'allpages',
'apnamespace' => '8',
'aplimit' => '500',
} while ( isset( $result['query-continue'] ) );
return $pages;
-
}
}
$content = ContentHandler::makeContent( $text, $title );
$page->doEditContent( $content, $comment, $flags, false, $user );
echo "done.\n";
-
} else {
echo "invalid username.\n";
}
-
} else {
echo "page exists.\n";
}
-
} else {
echo "invalid title.\n";
}
-
} else {
echo "does not exist.\n";
}
-
}
function titleFromFilename( $filename ) {
$parts = explode( '/', $filename );
- $parts = explode( '.', $parts[ count( $parts ) - 1 ] );
+ $parts = explode( '.', $parts[count( $parts ) - 1] );
+
return $parts[0];
}
function showHelp() {
-print <<<EOF
+ print <<<EOF
USAGE: php importTextFile.php <options> <filename>
<filename> : Path to the file containing page content to import
$installer->showMessage( 'config-env-good' );
} else {
$installer->showStatusMessage( $status );
+
return;
}
if ( !$this->hasOption( 'env-checks' ) ) {
<!DOCTYPE html>
<html>
<head>
- <meta charset="utf-8">
- <title>MediaWiki Code Example</title>
- <script src="modules/startup.js"></script>
- <script>
- function startUp() {
- mw.config = new mw.Map();
- }
- </script>
- <script src="modules/jquery/jquery.js"></script>
- <script src="modules/mediawiki/mediawiki.js"></script>
- <style>
- .mw-jsduck-log {
- position: relative;
- min-height: 3em;
- margin-top: 2em;
- background: #f7f7f7;
- border: 1px solid #e4e4e4;
- }
+ <meta charset="utf-8">
+ <title>MediaWiki Code Example</title>
+ <script src="modules/startup.js"></script>
+ <script>
+ function startUp() {
+ mw.config = new mw.Map();
+ }
+ </script>
+ <script src="modules/jquery/jquery.js"></script>
+ <script src="modules/mediawiki/mediawiki.js"></script>
+ <style>
+ .mw-jsduck-log {
+ position: relative;
+ min-height: 3em;
+ margin-top: 2em;
+ background: #f7f7f7;
+ border: 1px solid #e4e4e4;
+ }
- .mw-jsduck-log::after {
- position: absolute;
- bottom: 100%;
- right: -1px;
- padding: 0.5em;
- background: #fff;
- border: 1px solid #e4e4e4;
- border-bottom: 0;
- border-radius: 0.5em 0.5em 0 0;
- font: normal 0.5em sans-serif;
- content: 'console';
- }
+ .mw-jsduck-log::after {
+ position: absolute;
+ bottom: 100%;
+ right: -1px;
+ padding: 0.5em;
+ background: #fff;
+ border: 1px solid #e4e4e4;
+ border-bottom: 0;
+ border-radius: 0.5em 0.5em 0 0;
+ font: normal 0.5em sans-serif;
+ content: 'console';
+ }
- .mw-jsduck-log-line {
- padding: 0.2em 0.5em;
- white-space: pre-wrap;
- }
+ .mw-jsduck-log-line {
+ padding: 0.2em 0.5em;
+ white-space: pre-wrap;
+ }
- .mw-jsduck-log-line:nth-child(odd) {
- background: #fff;
- }
- </style>
+ .mw-jsduck-log-line:nth-child(odd) {
+ background: #fff;
+ }
+ </style>
</head>
<body>
- <script>
- /**
- * Basic log console for the example iframe in documentation pages.
- */
- ( function () {
- var pre;
- mw.log = function () {
- var str, i, len, line;
- if ( !pre ) {
- pre = document.createElement( 'pre' );
- pre.className = 'mw-jsduck-log';
- document.body.appendChild( pre );
- }
- str = [];
- for ( i = 0, len = arguments.length; i < len; i++ ) {
- str.push( String( arguments[ i ] ) );
- }
- line = document.createElement( 'div' );
- line.className = 'mw-jsduck-log-line';
- line.appendChild(
- document.createTextNode( str.join( ' , ' ) + '\n' )
- );
- pre.appendChild( line );
- };
- }() );
+<script>
+ /**
+ * Basic log console for the example iframe in documentation pages.
+ */
+ ( function () {
+ var pre;
+ mw.log = function () {
+ var str, i, len, line;
+ if ( !pre ) {
+ pre = document.createElement( 'pre' );
+ pre.className = 'mw-jsduck-log';
+ document.body.appendChild( pre );
+ }
+ str = [];
+ for ( i = 0, len = arguments.length; i < len; i++ ) {
+ str.push( String( arguments[ i ] ) );
+ }
+ line = document.createElement( 'div' );
+ line.className = 'mw-jsduck-log-line';
+ line.appendChild(
+ document.createTextNode( str.join( ' , ' ) + '\n' )
+ );
+ pre.appendChild( line );
+ };
+ }() );
- /**
- * Method called by jsduck to execute the example code.
- */
- function loadInlineExample( code, options, callback ) {
- try {
- eval( code );
- callback && callback( true );
- } catch (e) {
- mw.log( 'Uncaught exception: ' + e );
- callback && callback( false, e );
- throw e;
- }
- }
- </script>
+ /**
+ * Method called by jsduck to execute the example code.
+ */
+ function loadInlineExample( code, options, callback ) {
+ try {
+ eval( code );
+ callback && callback( true );
+ } catch ( e ) {
+ mw.log( 'Uncaught exception: ' + e );
+ callback && callback( false, e );
+ throw e;
+ }
+ }
+</script>
</body>
</html>
wfSuppressWarnings();
$return = sprintf( '%.' . $accuracy . 'f%%', 100 * $subset / $total );
wfRestoreWarnings();
+
return $return;
}
$xml = $this->open();
$this->callback = $callback;
- while ( $xml->name !== 'repertoire' && $xml->next() );
+ while ( $xml->name !== 'repertoire' && $xml->next() ) ;
while ( $xml->read() ) {
if ( $xml->nodeType == XMLReader::ELEMENT ) {
if ( !$this->xml ) {
throw new MWException( __METHOD__ . ": unable to open {$this->fileName}" );
}
- while ( $this->xml->name !== 'ucd' && $this->xml->read() );
+ while ( $this->xml->name !== 'ucd' && $this->xml->read() ) ;
$this->xml->read();
return $this->xml;
}
$xml = $this->open();
- while ( $xml->name !== 'blocks' && $xml->read() );
+ while ( $xml->name !== 'blocks' && $xml->read() ) ;
while ( $xml->read() ) {
if ( $xml->nodeType == XMLReader::ELEMENT ) {
/** @var array List of languages */
protected $mLanguages;
- /** @var array Raw list of the messages in each language */
+ /** @var array Raw list of the messages in each language */
protected $mRawMessages;
/** @var array Messages in each language (except for English), divided to groups */
foreach ( $servers as $server ) {
$this->output(
str_pad( $server, $maxSrvLen ),
- $server # output channel
+ $server # output channel
);
$mcc = new MemCachedClientforWiki( array(
*/
private function microtime_float() {
list( $usec, $sec ) = explode( " ", microtime() );
+
return ( (float)$usec + (float)$sec );
}
}
if ( $fileLines === false ) {
$this->hasError = true;
$this->error( "Unable to open list file $fileName." );
+
return $files;
}
# Strip comments, discard empty lines, and trim leading and trailing
}
}
}
+
return $files;
}
}
$this->mDescription = "Minify a file or set of files.\n\n" .
"If --outfile is not specified, then the output file names will have a .min extension\n" .
"added, e.g. jquery.js -> jquery.min.js.";
-
}
public function execute() {
// Minify one file
$this->minify( $this->getArg( 0 ), $this->getOption( 'outfile' ) );
+
return;
}
$this->error( "No file extension, cannot determine type: $fileName" );
exit( 1 );
}
+
return substr( $fileName, $dotPos + 1 );
}
---------------------------------------------------
TEXT
- );
+ );
if ( $exitcode !== 0 ) {
$this->error( "Something went wrong (exit: $exitcode)\n",
$exitcode );
}
-
}
-
}
$maintClass = 'MWDocGen';
$this->mDescription = "";
$this->addOption( 'fix', 'Attempt to automatically fix errors' );
$this->addOption( 'suffix', "Dupes will be renamed with correct namespace with " .
- "<text> appended after the article name", false, true );
+ "<text> appended after the article name", false, true );
$this->addOption( 'prefix', "Do an explicit check for the given title prefix " .
- "appended after the article name", false, true );
+ "appended after the article name", false, true );
}
public function execute() {
foreach ( $spaces as $name => $ns ) {
$ok = $this->checkNamespace( $ns, $name, $fix, $suffix ) && $ok;
}
+
return $ok;
}
foreach ( $result as $row ) {
$prefixes[] = $row['iw_prefix'];
}
+
return $prefixes;
}
$ok = $this->resolveConflict( $row, $resolvable, $suffix ) && $ok;
}
}
+
return $ok;
}
*/
private function checkPrefix( $key, $prefix, $fix, $suffix = '' ) {
$this->output( "Checking prefix \"$prefix\" vs namespace $key\n" );
+
return $this->checkNamespace( $key, $prefix, $fix, $suffix );
}
foreach ( $result as $row ) {
$set[] = $row;
}
+
return $set;
}
$row->oldnamespace,
$row->oldtitle ) );
$this->output( "... *** cannot resolve automatically; illegal title ***\n" );
+
return false;
}
$id = $newTitle->getArticleID();
if ( $id ) {
$this->output( "... *** cannot resolve automatically; page exists with ID $id ***\n" );
+
return false;
} else {
return true;
$title = Title::makeTitleSafe( $row->namespace, $row->title );
if ( !$title ) {
$this->output( "... !!! invalid title\n" );
+
return false;
}
$id = $title->getArticleID();
$this->output( "... *** using suffixed form [[" . $title->getPrefixedText() . "]] ***\n" );
}
$this->resolveConflictOn( $row, 'page', 'page' );
+
return true;
}
),
__METHOD__ );
$this->output( "ok.\n" );
+
return true;
}
}
$child = $this->runChild( 'NukePage', 'nukePage.php' );
$child->deleteRevisions( $revs );
$this->purgeRedundantText( true );
- $n_deleted ++;
+ $n_deleted++;
}
} else {
$this->output( "skip: " . $title->getPrefixedText() . "\n" );
if ( $wgSharedDB == null ) {
$this->output( "Database sharing is not enabled\n" );
+
return;
}
AND uccpk.table_name = '$ltable'" );
while ( ( $row = $result->fetchRow() ) !== false ) {
- $this->output( "Altering {$row['constraint_name']} ..." );
+ $this->output( "Altering {$row['constraint_name']} ..." );
- try {
- $dbw->query( "ALTER TABLE {$row['table_name']}
+ try {
+ $dbw->query( "ALTER TABLE {$row['table_name']}
DROP CONSTRAINT {$wgDBprefix}{$row['constraint_name']}" );
- } catch ( DBQueryError $exdb ) {
- if ( $exdb->errno != 2443 ) {
- throw $exdb;
- }
+ } catch ( DBQueryError $exdb ) {
+ if ( $exdb->errno != 2443 ) {
+ throw $exdb;
}
+ }
- $deleteRule = $row['delete_rule'] == 'NO ACTION' ? '' : "ON DELETE {$row['delete_rule']}";
- $dbw->query( "ALTER TABLE {$row['table_name']}
+ $deleteRule = $row['delete_rule'] == 'NO ACTION' ? '' : "ON DELETE {$row['delete_rule']}";
+ $dbw->query( "ALTER TABLE {$row['table_name']}
ADD CONSTRAINT {$wgDBprefix}{$row['constraint_name']}
FOREIGN KEY ({$row['column_name']})
REFERENCES {$wgSharedDB}.$stable({$row['pk_column_name']})
{$deleteRule} {$row['deferrable']} INITIALLY {$row['deferred']}" );
- $this->output( "DONE\n" );
+ $this->output( "DONE\n" );
}
}
}
-
}
$maintClass = "AlterSharedConstraints";
public function __construct() {
parent::__construct();
$this->mDescription = "Look for 'orphan' revisions hooked to pages which don't exist\n" .
- "and 'childless' pages with no revisions\n" .
- "Then, kill the poor widows and orphans\n" .
- "Man this is depressing";
+ "and 'childless' pages with no revisions\n" .
+ "Then, kill the poor widows and orphans\n" .
+ "Man this is depressing";
$this->addOption( 'fix', 'Actually fix broken entries' );
}
* @return Title object
*/
protected function getTitle() {
- $title =
- $this->getOption( 'title' )
+ $title = $this->getOption( 'title' )
? $this->getOption( 'title' )
: 'CLIParser';
+
return Title::newFromText( $title );
}
);
if ( $row ) {
$this->output( "Category table already populated. Use php " .
- "maintenance/populateCategory.php\n--force from the command line " .
- "to override.\n" );
+ "maintenance/populateCategory.php\n--force from the command line " .
+ "to override.\n" );
+
return true;
}
}
}
if ( $dbw->insert(
- 'updatelog',
- array( 'ul_key' => 'populate category' ),
- __METHOD__,
- 'IGNORE'
- )
- ) {
+ 'updatelog',
+ array( 'ul_key' => 'populate category' ),
+ __METHOD__,
+ 'IGNORE'
+ ) ) {
$this->output( "Category population complete.\n" );
+
return true;
} else {
$this->output( "Could not insert category population row.\n" );
+
return false;
}
}
if ( !$dbw->fieldExists( $table, 'fa_sha1', __METHOD__ ) ) {
$this->output( "fa_sha1 column does not exist\n\n", true );
+
return false;
}
);
if ( !$res ) {
$this->error( "No such file: $file", true );
+
return false;
}
$this->output( "Populating img_sha1 field for specified files\n" );
$db = $this->getDB( DB_MASTER );
if ( !$db->tableExists( 'log_search' ) ) {
$this->error( "log_search does not exist" );
+
return false;
}
$start = $db->selectField( 'logging', 'MIN(log_id)', false, __FUNCTION__ );
if ( !$start ) {
$this->output( "Nothing to do.\n" );
+
return true;
}
$end = $db->selectField( 'logging', 'MAX(log_id)', false, __FUNCTION__ );
// Add item author relations...
$log->addRelations( 'target_author_id', $userIds, $row->log_id );
$log->addRelations( 'target_author_ip', $userIPs, $row->log_id );
- // RevisionDelete logs - log events
} elseif ( LogEventsList::typeAction( $row, $delTypes, 'event' ) ) {
+ // RevisionDelete logs - log events
$params = LogPage::extractParams( $row->log_params );
// Param format: <item CSV> [<ofield> <nfield>]
if ( count( $params ) < 1 ) {
wfWaitForSlaves();
}
$this->output( "Done populating log_search table.\n" );
+
return true;
}
}
$start = $db->selectField( 'logging', 'MIN(log_id)', false, __METHOD__ );
if ( !$start ) {
$this->output( "Nothing to do.\n" );
+
return true;
}
$end = $db->selectField( 'logging', 'MAX(log_id)', false, __METHOD__ );
wfWaitForSlaves();
}
$this->output( "Done populating log_user_text field.\n" );
+
return true;
}
}
$db = wfGetDB( DB_MASTER );
if ( !$db->tableExists( 'revision' ) ) {
$this->error( "revision table does not exist" );
+
return false;
}
$this->output( "Populating rev_parent_id column\n" );
$end = $db->selectField( 'revision', 'MAX(rev_id)', false, __FUNCTION__ );
if ( is_null( $start ) || is_null( $end ) ) {
$this->output( "...revision table seems to be empty, nothing to do.\n" );
+
return true;
}
# Do remaining chunk
wfWaitForSlaves();
}
$this->output( "rev_parent_id population complete ... {$count} rows [{$changed} changed]\n" );
+
return true;
}
}
$start = $dbw->selectField( 'recentchanges', 'MIN(rc_id)', false, __METHOD__ );
if ( !$start ) {
$this->output( "Nothing to do.\n" );
+
return true;
}
$end = $dbw->selectField( 'recentchanges', 'MAX(rc_id)', false, __METHOD__ );
$this->error( "archive table does not exist", true );
} elseif ( !$db->fieldExists( 'revision', 'rev_len', __METHOD__ ) ) {
$this->output( "rev_len column does not exist\n\n", true );
+
return false;
}
$this->output( "rev_len and ar_len population complete "
. "[$rev revision rows, $ar archive rows].\n" );
+
return true;
}
$end = $db->selectField( $table, "MAX($idCol)", false, __METHOD__ );
if ( !$start || !$end ) {
$this->output( "...$table table seems to be empty.\n" );
+
return 0;
}
# This should not happen, but sometimes does (bug 20757)
$id = $row->$idCol;
$this->output( "Content of $table $id unavailable!\n" );
+
return false;
}
$this->error( "archive table does not exist", true );
} elseif ( !$db->fieldExists( 'revision', 'rev_sha1', __METHOD__ ) ) {
$this->output( "rev_sha1 column does not exist\n\n", true );
+
return false;
}
$this->output( "rev_sha1 and ar_sha1 population complete "
. "[$rc revision rows, $ac archive rows].\n" );
+
return true;
}
$end = $db->selectField( $table, "MAX($idCol)", false, __METHOD__ );
if ( !$start || !$end ) {
$this->output( "...$table table seems to be empty.\n" );
+
return 0;
}
$blockEnd += $this->mBatchSize;
wfWaitForSlaves();
}
+
return $count;
}
}
}
$db->commit( __METHOD__ );
+
return $count;
}
$text = $rev->getSerializedData();
} catch ( MWException $e ) {
$this->output( "Data of revision with {$idCol}={$row->$idCol} unavailable!\n" );
+
return false; // bug 22624?
}
if ( !is_string( $text ) ) {
# This should not happen, but sometimes does (bug 20757)
$this->output( "Data of revision with {$idCol}={$row->$idCol} unavailable!\n" );
+
return false;
} else {
$db->update( $table,
array( $idCol => $row->$idCol ),
__METHOD__
);
+
return true;
}
}
$rev = Revision::newFromArchiveRow( $row );
} catch ( MWException $e ) {
$this->output( "Text of revision with timestamp {$row->ar_timestamp} unavailable!\n" );
+
return false; // bug 22624?
}
$text = $rev->getSerializedData();
if ( !is_string( $text ) ) {
# This should not happen, but sometimes does (bug 20757)
$this->output( "Data of revision with timestamp {$row->ar_timestamp} unavailable!\n" );
+
return false;
} else {
# Archive table as no PK, but (NS,title,time) should be near unique.
),
__METHOD__
);
+
return true;
}
}
public function getStripList() {
global $wgParser;
+
return $wgParser->getStripList();
}
// It's done by the MW UI, so it's a reasonably legitimate thing to do.
global $wgContLang;
$s = $wgContLang->normalize( $s );
+
return $s;
}
function pickEntryPoint() {
$count = count( $this->entryPoints );
- return $this->entryPoints[ mt_rand( 0, $count - 1 ) ];
+
+ return $this->entryPoints[mt_rand( 0, $count - 1 )];
}
}
'text' => $text,
'finalTitle' => $finalTitle );
}
+
return $this->templates[$titleText];
}
// "Output type: {$this->outputType}\n" .
"Entry point: {$this->entryPoint}\n" .
"User: " . ( $this->fancySig ? 'fancy' : 'no-fancy' ) .
- ' ' . var_export( $this->nickname, true ) . "\n" .
+ ' ' . var_export( $this->nickname, true ) . "\n" .
"Main text: " . var_export( $this->mainText, true ) . "\n";
foreach ( $this->templates as $titleText => $template ) {
$finalTitle = $template['finalTitle'];
// Sanity check to avoid data loss
$repo->getBackend()->delete( array( 'src' => $file->getPath() ) );
$this->verbose( "Deleted orphan file: {$file->getPath()}.\n" );
-
} else {
$this->error( "File was not deleted: {$file->getPath()}.\n" );
}
// Purge items from fileachive table (rows are likely here)
$this->purgeFromArchiveTable( $repo, $file );
-
} elseif ( $logType === 'move' ) {
// Purge the target file as well
// Sanity check to avoid data loss
$repo->getBackend()->delete( array( 'src' => $ofile->getPath() ) );
$this->output( "Deleted orphan file: {$ofile->getPath()}.\n" );
-
} else {
$this->error( "File was not deleted: {$ofile->getPath()}.\n" );
}
protected function getDeletedPath( LocalRepo $repo, LocalFile $file ) {
$hash = $repo->getFileSha1( $file->getPath() );
$key = "{$hash}.{$file->getExtension()}";
+
return $repo->getDeletedHashPath( $key ) . $key;
}
$this->output( $msg );
}
}
-
}
$maintClass = "PurgeChangedFiles";
}
}
$lastValueLeft = count( $rows ) ? $rows[count( $rows ) - 1]->$column : null;
+
return array( $rows, $lastValueLeft );
}
}
$u->doUpdate();
}
}
-
}
$maintClass = "PurgeList";