DeferredUpdates::addUpdate( $update );
}
if ( $wgRCWatchCategoryMembership
+ && $this->getContentHandler()->supportsCategories() === true
&& ( $options['changed'] || $options['created'] )
&& !$options['restored']
) {
* @param int &$cascade Set to false if cascading protection isn't allowed.
* @param string $reason
* @param User $user The user updating the restrictions
- * @return Status
+ * @param string|string[] $tags Change tags to add to the pages and protection log entries
+ * ($user should be able to add the specified tags before this is called)
+ * @return Status Status object; if action is taken, $status->value is the log_id of the
+ * protection log entry.
*/
public function doUpdateRestrictions( array $limit, array $expiry,
- &$cascade, $reason, User $user
+ &$cascade, $reason, User $user, $tags = null
) {
global $wgCascadingRestrictionLevels, $wgContLang;
$logRelationsField = null;
$logParamsDetails = [];
+ // Null revision (used for change tag insertion)
+ $nullRevision = null;
+
if ( $id ) { // Protection of existing page
if ( !Hooks::run( 'ArticleProtect', [ &$this, &$user, $limit, $reason ] ) ) {
return Status::newGood();
$logEntry->setComment( $reason );
$logEntry->setPerformer( $user );
$logEntry->setParameters( $params );
+ if ( !is_null( $nullRevision ) ) {
+ $logEntry->setAssociatedRevId( $nullRevision->getId() );
+ }
+ $logEntry->setTags( $tags );
if ( $logRelationsField !== null && count( $logRelationsValues ) ) {
$logEntry->setRelations( [ $logRelationsField => $logRelationsValues ] );
}
$logId = $logEntry->insert();
$logEntry->publish( $logId );
- return Status::newGood();
+ return Status::newGood( $logId );
}
/**