public $contentFormat = null;
/** @var null|array */
- public $changeTags = null;
+ private $changeTags = null;
# Placeholders for text injection by hooks (must be HTML)
# extensions should take care to _append_ to the present value
$flags,
false,
$wgUser,
- $content->getDefaultFormat()
+ $content->getDefaultFormat(),
+ $this->changeTags
);
if ( !$doEditStatus->isOK() ) {
$this->updateWatchlist();
- if ( $this->changeTags && isset( $doEditStatus->value['revision'] ) ) {
- // If a revision was created, apply any change tags that were requested
- $addTags = $this->changeTags;
- $revId = $doEditStatus->value['revision']->getId();
- // Defer this both for performance and so that addTags() sees the rc_id
- // since the recentchange entry addition is deferred first (bug T100248)
- DeferredUpdates::addCallableUpdate( function() use ( $addTags, $revId ) {
- ChangeTags::addTags( $addTags, null, $revId );
- } );
- }
-
// If the content model changed, add a log entry
if ( $changingContentModel ) {
$this->addContentModelChangeLogEntry(
$token,
$params['markbot'],
$details,
- $user
+ $user,
+ $params['tags']
);
if ( $retval ) {
// Watch pages
$this->setWatch( $watch, $titleObj, 'watchrollback' );
- if ( count( $params['tags'] ) ) {
- ChangeTags::addTags( $params['tags'], null, intval( $details['newid'] ), null, null );
- }
-
$info = array(
'title' => $titleObj->getPrefixedText(),
'pageid' => intval( $details['current']->getPage() ),
* @param int $newSize
* @param int $newId
* @param int $patrol
+ * @param array $tags
* @return RecentChange
*/
public static function notifyEdit(
$timestamp, &$title, $minor, &$user, $comment, $oldId, $lastTimestamp,
- $bot, $ip = '', $oldSize = 0, $newSize = 0, $newId = 0, $patrol = 0
+ $bot, $ip = '', $oldSize = 0, $newSize = 0, $newId = 0, $patrol = 0,
+ $tags = array()
) {
$rc = new RecentChange;
$rc->mTitle = $title;
'pageStatus' => 'changed'
);
- DeferredUpdates::addCallableUpdate( function() use ( $rc ) {
+ DeferredUpdates::addCallableUpdate( function() use ( $rc, $tags ) {
$rc->save();
if ( $rc->mAttribs['rc_patrolled'] ) {
PatrolLog::record( $rc, true, $rc->getPerformer() );
}
+ if ( count( $tags ) ) {
+ ChangeTags::addTags( $tags, $rc->mAttribs['rc_id'],
+ $rc->mAttribs['rc_this_oldid'], null, null );
+ }
} );
return $rc;
* @param int $size
* @param int $newId
* @param int $patrol
+ * @param array $tags
* @return RecentChange
*/
public static function notifyNew(
$timestamp, &$title, $minor, &$user, $comment, $bot,
- $ip = '', $size = 0, $newId = 0, $patrol = 0
+ $ip = '', $size = 0, $newId = 0, $patrol = 0, $tags = array()
) {
$rc = new RecentChange;
$rc->mTitle = $title;
'pageStatus' => 'created'
);
- DeferredUpdates::addCallableUpdate( function() use ( $rc ) {
+ DeferredUpdates::addCallableUpdate( function() use ( $rc, $tags ) {
$rc->save();
if ( $rc->mAttribs['rc_patrolled'] ) {
PatrolLog::record( $rc, true, $rc->getPerformer() );
}
+ if ( count( $tags ) ) {
+ ChangeTags::addTags( $tags, $rc->mAttribs['rc_id'],
+ $rc->mAttribs['rc_this_oldid'], null, null );
+ }
} );
return $rc;
* @param User $user The user doing the edit
* @param string $serialFormat Format for storing the content in the
* database.
+ * @param array|null $tags Change tags to apply to this edit
+ * Callers are responsible for permission checks
+ * (with ChangeTags::canAddTagsAccompanyingChange)
*
* @throws MWException
* @return Status Possible errors:
*/
public function doEditContent(
Content $content, $summary, $flags = 0, $baseRevId = false,
- User $user = null, $serialFormat = null
+ User $user = null, $serialFormat = null, $tags = null
) {
global $wgUser, $wgUseAutomaticEditSummaries;
'oldContent' => $old_content,
'oldId' => $this->getLatest(),
'oldIsRedirect' => $this->isRedirect(),
- 'oldCountable' => $this->isCountable()
+ 'oldCountable' => $this->isCountable(),
+ 'tags' => ( $tags !== null ) ? (array)$tags : array()
);
// Actually create the revision and create/update the page
$oldContent ? $oldContent->getSize() : 0,
$newsize,
$revisionId,
- $patrolled
+ $patrolled,
+ $meta['tags']
);
}
'',
$newsize,
$revisionId,
- $patrolled
+ $patrolled,
+ $meta['tags']
);
}
* success : 'summary' (str), 'current' (rev), 'target' (rev)
*
* @param User $user The user performing the rollback
+ * @param array|null $tags Change tags to apply to the rollback
+ * Callers are responsible for permission checks
+ * (with ChangeTags::canAddTagsAccompanyingChange)
+ *
* @return array Array of errors, each error formatted as
* array(messagekey, param1, param2, ...).
* On success, the array is empty. This array can also be passed to
* OutputPage::showPermissionsErrorPage().
*/
public function doRollback(
- $fromP, $summary, $token, $bot, &$resultDetails, User $user
+ $fromP, $summary, $token, $bot, &$resultDetails, User $user, $tags = null
) {
$resultDetails = null;
return $errors;
}
- return $this->commitRollback( $fromP, $summary, $bot, $resultDetails, $user );
+ return $this->commitRollback( $fromP, $summary, $bot, $resultDetails, $user, $tags );
}
/**
*
* @param array $resultDetails Contains result-specific array of additional values
* @param User $guser The user performing the rollback
+ * @param array|null $tags Change tags to apply to the rollback
+ * Callers are responsible for permission checks
+ * (with ChangeTags::canAddTagsAccompanyingChange)
+ *
* @return array
*/
- public function commitRollback( $fromP, $summary, $bot, &$resultDetails, User $guser ) {
+ public function commitRollback( $fromP, $summary, $bot,
+ &$resultDetails, User $guser, $tags = null
+ ) {
global $wgUseRCPatrol, $wgContLang;
$dbw = wfGetDB( DB_MASTER );
$summary,
$flags,
$target->getId(),
- $guser
+ $guser,
+ null,
+ $tags
);
// Set patrolling and bot flag on the edits, which gets rollbacked.