4require_once __DIR__ .
'/Maintenance.php';
21 parent::__construct();
23 $this->
addDescription(
'Exports site definitions from the sites table to XML file' );
25 $this->
addArg(
'file',
'A file to write the XML to (see docs/sitelist.md). ' .
26 'Use "php://stdout" to write to stdout.',
true
34 $file = $this->
getArg( 0 );
36 if ( $file ===
'php://output' || $file ===
'php://stdout' ) {
40 $handle = fopen( $file,
'w' );
43 $this->
fatalError(
"Failed to open $file for writing.\n" );
49 $exporter->exportSites( $siteLookup->getSites() );
53 $this->
output(
"Exported sites to " . realpath( $file ) .
".\n" );
60require_once RUN_MAINTENANCE_IF_MAIN;
Maintenance script for exporting site definitions from the sites table to XML.
__construct()
Default constructor.
execute()
Do the actual work.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
addArg( $arg, $description, $required=true, $multi=false)
Add some args that are needed.
getArg( $argId=0, $default=null)
Get an argument.
output( $out, $channel=null)
Throw some output to the user.
fatalError( $msg, $exitCode=1)
Output a message and terminate the current script.
getServiceContainer()
Returns the main service container.
addDescription( $text)
Set the description text.