29require_once __DIR__ .
'/Maintenance.php';
42 parent::__construct();
44 $this->
addOption(
'file',
'File with text to run.',
false,
true );
45 $this->
addOption(
'dump',
'XML dump to execute all revisions.',
false,
true );
46 $this->
addOption(
'from',
'Article from XML dump to start from.',
false,
true );
51 $this->
fatalError(
"You must provide a file or dump" );
60 $revision->setTitle( Title::newFromText(
70 if ( $this->
getOption(
'dump' ) ==
'-' ) {
73 $this->
fatalError(
"Sorry, I don't support dump filenames yet. "
74 .
"Use - and provide it on stdin on the meantime." );
78 $importer->setRevisionCallback(
79 [ $this,
'handleRevision' ] );
80 $importer->setNoticeCallback(
function ( $msg,
$params ) {
84 $this->from = $this->
getOption(
'from',
null );
86 $importer->doImport();
91 $this->
error(
"Done {$this->count} revisions in " .
round( $delta, 2 ) .
" seconds " );
93 $this->
error(
round( $this->count / $delta, 2 ) .
" pages/sec" );
96 # Perform the memory_get_peak_usage() when all the other data has been
97 # output so there's no damage if it dies. It is only available since
98 # 5.2.0 (since 5.2.1 if you haven't compiled with --enable-memory-limit)
103 parent::finalSetup();
109 $wgHooks[
'InterwikiLoadPrefix'][] =
'DumpIterator::disableInterwikis';
114 # Title::newFromText will check on each namespaced article if it's an interwiki.
115 # We always answer that it is not.
126 $title =
$rev->getTitle();
128 $this->
error(
"Got bogus revision with null title!" );
134 if (
isset( $this->from ) ) {
135 if ( $this->from != $title ) {
138 $this->
output(
"Skipped " . ( $this->count - 1 ) .
" pages\n" );
167 parent::__construct();
168 $this->
addDescription(
'Runs a regex in the revisions from a dump' );
169 $this->
addOption(
'regex',
'Searching regex',
true,
true );
181 $this->
output(
$rev->getTitle() .
" matches at edit from " .
$rev->getTimestamp() .
"\n" );
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
$wgUseDatabaseMessages
Translation using MediaWiki: namespace.
$wgLocalisationCacheConf
Localisation cache configuration.
Base class for interating over a dump.
static disableInterwikis( $prefix, &$data)
__construct()
Default constructor.
execute()
Do the actual work.
finalSetup()
Handle some last-minute setup here.
handleRevision( $rev)
Callback function for each revision, child classes should override processRevision instead.
Imports a XML dump from a file (either from file upload, files on disk, or HTTP)
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
const DB_NONE
Constants for DB access type.
output( $out, $channel=null)
Throw some output to the user.
getStdin( $len=null)
Return input from stdin.
hasOption( $name)
Checks to see if a particular option exists.
getDbType()
Does the script need different DB access? By default, we give Maintenance scripts normal rights to th...
addDescription( $text)
Set the description text.
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
getOption( $name, $default=null)
Get an option, or return the default.
fatalError( $msg, $exitCode=1)
Output a message and terminate the current script.
Maintenance script that runs a regex in the revisions from a dump.
__construct()
Default constructor.
getDbType()
Does the script need different DB access? By default, we give Maintenance scripts normal rights to th...
XML file reader for the page data importer.
Represents a revision, log entry or upload during the import process.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults error
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
$wgHooks['ArticleShow'][]
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
require_once RUN_MAINTENANCE_IF_MAIN