36require_once __DIR__ .
'/TableCleanup.php';
47 'table' =>
'watchlist',
48 'index' => [
'wl_id' ],
50 'callback' =>
'processRow'
54 parent::__construct();
55 $this->
addDescription(
'Script to remove broken, unparseable titles in the Watchlist' );
56 $this->
addOption(
'fix',
'Actually remove entries; without will only report.' );
61 $this->
output(
"Dry run only: use --fix to enable updates\n" );
67 $current = Title::makeTitle( $row->wl_namespace, $row->wl_title );
68 $display = $current->getPrefixedText();
70 $title = Title::newFromText( $verified );
72 if ( $row->wl_user == 0 || $title ===
null || !$title->equals( $current ) ) {
73 $this->
output(
"invalid watch by {$row->wl_user} for "
74 .
"({$row->wl_namespace}, \"{$row->wl_title}\")\n" );
75 $updated = $this->removeWatch( $row );
83 private function removeWatch( $row ) {
84 if ( !$this->dryrun && $this->
hasOption(
'fix' ) ) {
86 $dbw->newDeleteQueryBuilder()
87 ->deleteFrom(
'watchlist' )
88 ->where( [
'wl_id' => $row->wl_id ] )
89 ->caller( __METHOD__ )
91 if ( $this->
getConfig()->
get( MainConfigNames::WatchlistExpiry ) ) {
92 $dbw->newDeleteQueryBuilder()
93 ->deleteFrom(
'watchlist_expiry' )
94 ->where( [
'we_item' => $row->wl_id ] )
95 ->caller( __METHOD__ )
99 $this->
output(
"- removed\n" );
110require_once RUN_MAINTENANCE_IF_MAIN;
Maintenance script to remove broken, unparseable titles in the watchlist table.
execute()
Do the actual work.
__construct()
Default constructor.
A class containing constants representing the names of configuration variables.
output( $out, $channel=null)
Throw some output to the user.
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.
getServiceContainer()
Returns the main service container.
addDescription( $text)
Set the description text.
Generic class to cleanup a database table.