11 require_once __DIR__ .
'/Maintenance.php';
15 parent::__construct();
17 $this->
addArg(
'tag name',
'Name of the tag to delete' );
24 $defStore = $services->getChangeTagDefStore();
25 $lbFactory = $services->getDBLoadBalancerFactory();
26 $options = [
'domain' => $lbFactory->getLocalDomainID() ];
30 $tagId = $defStore->getId( $tag );
36 if ( !$status->isOK() ) {
37 $message = $status->getHTML(
false,
false,
'en' );
38 $this->
fatalError( Sanitizer::stripAllTags( $message ) );
41 $this->
output(
"Deleting tag '$tag'...\n" );
48 'ctd_user_defined' => 0,
51 [
'ctd_id' => $tagId ],
59 $ids = $dbw->newSelectQueryBuilder()
61 ->from(
'change_tag' )
62 ->where( [
'ct_tag_id' => $tagId ] )
64 ->caller( __METHOD__ )
70 $dbw->delete(
'change_tag', [
'ct_id' => $ids ], __METHOD__ );
71 $count += $dbw->affectedRows();
72 $this->
output(
"$count\n" );
73 $lbFactory->waitForReplication( $options );
75 $this->
output(
"The tag has been removed from $count revisions, deleting the tag itself...\n" );
78 $this->
output(
"Done.\n" );
83 require_once RUN_MAINTENANCE_IF_MAIN;
__construct()
Default constructor.
execute()
Do the actual work.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
getDB( $db, $groups=[], $dbDomain=false)
Returns a database to be used by current maintenance script.
addArg( $arg, $description, $required=true, $multi=false)
Add some args that are needed.
output( $out, $channel=null)
Throw some output to the user.
getServiceContainer()
Returns the main service container.
getBatchSize()
Returns batch size.
getArg( $argId=0, $default=null)
Get an argument.
addDescription( $text)
Set the description text.
fatalError( $msg, $exitCode=1)
Output a message and terminate the current script.