Go to the documentation of this file.
24 require_once __DIR__ .
'/Maintenance.php';
33 parent::__construct();
34 $this->mDescription =
"Edit an article from the command line, text is from stdin";
35 $this->
addOption(
'user',
'Username',
false,
true,
'u' );
36 $this->
addOption(
'summary',
'Edit summary',
false,
true,
's' );
37 $this->
addOption(
'minor',
'Minor edit',
false,
false,
'm' );
38 $this->
addOption(
'bot',
'Bot edit',
false,
false,
'b' );
39 $this->
addOption(
'autosummary',
'Enable autosummary',
false,
false,
'a' );
40 $this->
addOption(
'no-rc',
'Do not show the change in recent changes',
false,
false,
'r' );
41 $this->
addOption(
'nocreate',
'Don\'t create new pages',
false,
false );
42 $this->
addOption(
'createonly',
'Only create new pages',
false,
false );
43 $this->
addArg(
'title',
'Title of article to edit' );
49 $userName = $this->
getOption(
'user',
'Maintenance script' );
53 $autoSummary = $this->
hasOption(
'autosummary' );
60 $this->
error(
"Invalid username",
true );
62 if ( $wgUser->isAnon() ) {
68 $this->
error(
"Invalid title",
true );
70 $context->setTitle(
$title );
73 $this->
error(
"Page does not exist",
true );
75 $this->
error(
"Page already exists",
true );
85 $this->
output(
"Saving... " );
86 $status = $page->doEditContent( $content,
$summary,
91 if ( $status->isOK() ) {
95 $this->
output(
"failed\n" );
98 if ( !$status->isGood() ) {
99 $this->
output( $status->getWikiText() .
"\n" );
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
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.
addOption( $name, $description, $required=false, $withArg=false, $shortName=false)
Add a parameter to the script.
require_once RUN_MAINTENANCE_IF_MAIN
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
__construct()
Default constructor.
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
when a variable name is used in a it is silently declared as a new masking the global
static makeContent( $text, Title $title=null, $modelId=null, $format=null)
Convenience function for creating a Content object from a given textual representation.
presenting them properly to the user as errors is done by the caller $title
static getMain()
Static methods.
Maintenance script to make a page edit.
getOption( $name, $default=null)
Get an option, or return the default.
addArg( $arg, $description, $required=true)
Add some args that are needed.
error( $err, $die=0)
Throw an error to the user.
output( $out, $channel=null)
Throw some output to the user.
hasOption( $name)
Checks to see if a particular param exists.
getArg( $argId=0, $default=null)
Get an argument.
execute()
Do the actual work.