require_once __DIR__ .
'/includes/BackupDumper.php';
37parent::__construct();
40This script dumps the wiki page or logging database into an
41XML interchange wrapper format
forexport or backup.
45WARNING:
thisis not a full database
dump! It is merely
for publicexport
46of your wiki. For full backup, see our online help at:
52$this->
addOption(
'full',
'Dump all revisions of every page');
53$this->
addOption(
'current',
'Dump only the latest revision of every page.');
54$this->
addOption(
'logs',
'Dump all log events');
55$this->
addOption(
'stable',
'Dump stable versions of pages');
56$this->
addOption(
'revrange',
'Dump range of revisions specified by revstart and '.
57 'revend parameters');
58$this->
addOption(
'orderrevs',
'Dump revisions in ascending revision order '.
59 '(implies dump of a range of pages)');
61 'Dump only pages included in the file',
false,
true);
63$this->
addOption(
'start',
'Start from page_id or log_id',
false,
true);
64$this->
addOption(
'end',
'Stop before page_id or log_id n (exclusive)',
false,
true);
65$this->
addOption(
'revstart',
'Start from rev_id',
false,
true);
66$this->
addOption(
'revend',
'Stop before rev_id n (exclusive)',
false,
true);
67$this->
addOption(
'skip-header',
'Don\'t output the <mediawiki> header');
68$this->
addOption(
'skip-footer',
'Don\'t output the </mediawiki> footer');
69$this->
addOption(
'stub',
'Don\'t perform old_text lookups; for 2-pass dump');
70$this->
addOption(
'uploads',
'Include upload records without files');
71$this->
addOption(
'include-files',
'Include files within the XML stream');
72$this->
addOption(
'namespaces',
'Limit to this comma-separated list of namespace numbers');
83$textMode = $this->
hasOption(
'stub') ? WikiExporter::STUB : WikiExporter::TEXT;
86$this->
dump( WikiExporter::FULL, $textMode );
87} elseif ( $this->
hasOption(
'current') ) {
88$this->
dump( WikiExporter::CURRENT, $textMode );
89} elseif ( $this->
hasOption(
'stable') ) {
90$this->
dump( WikiExporter::STABLE, $textMode );
91} elseif ( $this->
hasOption(
'logs') ) {
92$this->
dump( WikiExporter::LOGS );
93} elseif ( $this->
hasOption(
'revrange') ) {
94$this->
dump( WikiExporter::RANGE, $textMode );
96$this->
fatalError(
'No valid action specified.');
101parent::processOptions();
104$this->reporting = !$this->
hasOption(
'quiet');
106 if( $this->
hasOption(
'pagelist') ) {
107$filename = $this->
getOption(
'pagelist');
108 $pages= file( $filename );
110$this->
fatalError(
"Unable to open file {$filename}\n");
113$this->pages = array_filter(
$pages,
static function( $x ) {
119$this->startId = intval( $this->
getOption(
'start') );
123$this->endId = intval( $this->
getOption(
'end') );
126 if( $this->
hasOption(
'revstart') ) {
127$this->revStartId = intval( $this->
getOption(
'revstart') );
131$this->revEndId = intval( $this->
getOption(
'revend') );
134$this->skipHeader = $this->
hasOption(
'skip-header');
135$this->skipFooter = $this->
hasOption(
'skip-footer');
136$this->dumpUploads = $this->
hasOption(
'uploads');
137$this->dumpUploadFileContents = $this->
hasOption(
'include-files');
138$this->orderRevs = $this->
hasOption(
'orderrevs');
139 if( $this->
hasOption(
'namespaces') ) {
140$this->limitNamespaces = explode(
',', $this->
getOption(
'namespaces') );
142$this->limitNamespaces =
null;
149require_once RUN_MAINTENANCE_IF_MAIN;
execute()
Do the actual work.
processOptions()
Processes arguments and sets $this->$sink accordingly.
__construct(?array $args=null)
dump( $history, $text=WikiExporter::TEXT)
string[] null $pages
null means all pages
output( $out, $channel=null)
Throw some output to the user.
loadWithArgv( $argv)
Load params and arguments from a given array of command-line arguments.
fatalError( $msg, $exitCode=1)
Output a message and terminate the current script.
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
hasOption( $name)
Checks to see if a particular option was set.
getOption( $name, $default=null)
Get an option, or return the default.
addDescription( $text)
Set the description text.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4