Go to the documentation of this file.
29 require_once __DIR__ .
'/Maintenance.php';
42 parent::__construct();
43 $this->mDescription =
"Does something with a dump";
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->
error(
"You must provide a file or dump",
true );
65 $this->startTime = microtime(
true );
67 if ( $this->
getOption(
'dump' ) ==
'-' ) {
70 $this->
error(
"Sorry, I don't support dump filenames yet. Use - and provide it on stdin on the meantime.",
true );
74 $importer->setRevisionCallback(
75 array( &$this,
'handleRevision' ) );
79 $importer->doImport();
84 $this->
error(
"Done {$this->count} revisions in " . round( $delta, 2 ) .
" seconds " );
86 $this->
error( round( $this->count / $delta, 2 ) .
" pages/sec" );
89 # Perform the memory_get_peak_usage() when all the other data has been output so there's no damage if it dies.
90 # It is only available since 5.2.0 (since 5.2.1 if you haven't compiled with --enable-memory-limit)
91 $this->
error(
"Memory peak usage of " . memory_get_peak_usage() .
" bytes\n" );
99 $wgUseDatabaseMessages =
false;
100 $wgLocalisationCacheConf[
'storeClass'] =
'LCStoreNull';
101 $wgHooks[
'InterwikiLoadPrefix'][] =
'DumpIterator::disableInterwikis';
106 # Title::newFromText will check on each namespaced article if it's an interwiki.
107 # We always answer that it is not.
120 $this->
error(
"Got bogus revision with null title!" );
125 if ( isset( $this->
from ) ) {
129 $this->
output(
"Skipped " . ( $this->count - 1 ) .
" pages\n" );
160 parent::__construct();
161 $this->mDescription =
"Runs a regex in the revisions from a dump";
162 $this->
addOption(
'regex',
'Searching regex',
true,
true );
173 if ( preg_match( $this->
getOption(
'regex' ),
$rev->getContent()->getTextForSearchIndex() ) ) {
174 $this->
output(
$rev->getTitle() .
" matches at edit from " .
$rev->getTimestamp() .
"\n" );
XML file reader for the page data importer.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
__construct()
Default constructor.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
getStdin( $len=null)
Return input from stdin.
getDbType()
Does the script need different DB access? By default, we give Maintenance scripts normal rights to th...
handleRevision( $rev)
Callback function for each revision, child classes should override processRevision instead.
getDbType()
Does the script need different DB access? By default, we give Maintenance scripts normal rights to th...
addOption( $name, $description, $required=false, $withArg=false, $shortName=false)
Add a parameter to the script.
require_once RUN_MAINTENANCE_IF_MAIN
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
$wgHooks['ArticleShow'][]
execute()
Do the actual work.
Maintenance script that runs a regex in the revisions from a dump.
__construct()
Default constructor.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
presenting them properly to the user as errors is done by the caller $title
static disableInterwikis( $prefix, &$data)
const DB_NONE
Constants for DB access type.
Base class for interating over a dump.
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
getOption( $name, $default=null)
Get an option, or return the default.
if(PHP_SAPI !='cli') $source
error( $err, $die=0)
Throw an error to the user.
output( $out, $channel=null)
Throw some output to the user.
finalSetup()
Handle some last-minute setup here.
Please log in again after you receive it</td >< td > s a saved copy from
hasOption( $name)
Checks to see if a particular param exists.