* (bug 13157) Added ucuserprefix parameter to list=usercontibs
* (bug 12394) Added rctitles parameter to list=recentchanges, making rcid retrieval easier
* (bug 13218) Fix inclusion of " character in hyperlinks
+* Added watch and unwatch parameters to action=delete and action=move
=== Languages updated in 1.13 ===
$reason = (isset($params['reason']) ? $params['reason'] : NULL);
$dbw = wfGetDb(DB_MASTER);
$dbw->begin();
- $retval = self::delete($articleObj, $params['token'], $reason);
+ $retval = self::delete($articleObj, $params['token'], $reason);
if(!empty($retval))
// We don't care about multiple errors, just report one of them
$this->dieUsageMsg(current($retval));
-
+
+ if($params['watch'] || $wgUser->getOption('watchdeletion'))
+ $articleObj->doWatch();
+ else if($params['unwatch'])
+ $articleObj->doUnwatch();
$dbw->commit();
$r = array('title' => $titleObj->getPrefixedText(), 'reason' => $reason);
$this->getResult()->addValue(null, $this->getModuleName(), $r);
'title' => null,
'token' => null,
'reason' => null,
+ 'watch' => false,
+ 'unwatch' => false
);
}
return array (
'title' => 'Title of the page you want to delete.',
'token' => 'A delete token previously retrieved through prop=info',
- 'reason' => 'Reason for the deletion. If not set, an automatically generated reason will be used.'
+ 'reason' => 'Reason for the deletion. If not set, an automatically generated reason will be used.',
+ 'watch' => 'Add the page to your watchlist',
+ 'unwatch' => 'Remove the page from your watchlist'
);
}
$this->dieUsageMsg(array($retval));
$r = array('from' => $fromTitle->getPrefixedText(), 'to' => $toTitle->getPrefixedText(), 'reason' => $params['reason']);
- if(!$params['noredirect'])
+ if(!$params['noredirect'] || !$wgUser->isAllowed('suppressredirect'))
$r['redirectcreated'] = '';
if($params['movetalk'] && $fromTalk->exists() && !$fromTitle->isTalkPage())
$r['talkmove-error-info'] = ApiBase::$messageMap[$retval]['info'];
}
}
+
+ # Watch pages
+ if($params['watch'] || $wgUser->getOption('watchmoves'))
+ {
+ $wgUser->addWatch($fromTitle);
+ $wgUser->addWatch($toTitle);
+ }
+ else if($params['unwatch'])
+ {
+ $wgUser->removeWatch($fromTitle);
+ $wgUser->removeWatch($toTitle);
+ }
$dbw->commit(); // Make sure all changes are really written to the DB
$this->getResult()->addValue(null, $this->getModuleName(), $r);
}
'token' => null,
'reason' => null,
'movetalk' => false,
- 'noredirect' => false
+ 'noredirect' => false,
+ 'watch' => false,
+ 'unwatch' => false
);
}
'token' => 'A move token previously retrieved through prop=info',
'reason' => 'Reason for the move (optional).',
'movetalk' => 'Move the talk page, if it exists.',
- 'noredirect' => 'Don\'t create a redirect'
+ 'noredirect' => 'Don\'t create a redirect',
+ 'watch' => 'Add the page and the redirect to your watchlist',
+ 'unwatch' => 'Remove the page and the redirect from your watchlist'
);
}