4 * Adds a change tag to the wiki.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * http://www.gnu.org/copyleft/gpl.html
22 * @ingroup Maintenance
25 require_once __DIR__
. '/Maintenance.php';
28 * Adds a change tag to the wiki
30 * @ingroup Maintenance
33 class AddChangeTag
extends Maintenance
{
35 public function __construct() {
36 parent
::__construct();
37 $this->addDescription( 'Adds a change tag to the wiki.' );
39 $this->addOption( 'tag', 'Tag to add', true, true );
40 $this->addOption( 'reason', 'Reason for adding the tag', true, true );
43 public function execute() {
44 $user = User
::newSystemUser( 'Maintenance script', [ 'steal' => true ] );
46 $tag = $this->getOption( 'tag' );
48 $status = ChangeTags
::createTagWithChecks(
50 $this->getOption( 'reason' ),
54 if ( !$status->isGood() ) {
55 $this->fatalError( $status->getWikiText( null, null, 'en' ) );
58 $this->output( "$tag was created.\n" );
62 $maintClass = AddChangeTag
::class;
63 require_once RUN_MAINTENANCE_IF_MAIN
;