public function areAnySuppressed() {
$bit = $this->getSuppressBit();
- /** @var $item RevDelItem */
+ /** @var RevDelItem $item */
foreach ( $this as $item ) {
if ( $item->getBits() & $bit ) {
return true;
* @since 1.23 Added 'perItemStatus' param
*/
public function setVisibility( array $params ) {
+ global $wgActorTableSchemaMigrationStage;
+
$status = Status::newGood();
$bitPars = $params['value'];
$comment = $params['comment'];
- $perItemStatus = isset( $params['perItemStatus'] ) ? $params['perItemStatus'] : false;
+ $perItemStatus = $params['perItemStatus'] ?? false;
// CAS-style checks are done on the _deleted fields so the select
// does not need to use FOR UPDATE nor be in the atomic section
$missing = array_flip( $this->ids );
$this->clearFileOps();
$idsForLog = [];
- $authorIds = $authorIPs = [];
+ $authorIds = $authorIPs = $authorActors = [];
if ( $perItemStatus ) {
$status->itemStatuses = [];
// passed to doPostCommitUpdates().
$visibilityChangeMap = [];
- /** @var $item RevDelItem */
+ /** @var RevDelItem $item */
foreach ( $this as $item ) {
unset( $missing[$item->getId()] );
$virtualOldBits |= $removedBits;
$status->successCount++;
- if ( $item->getAuthorId() > 0 ) {
- $authorIds[] = $item->getAuthorId();
- } elseif ( IP::isIPAddress( $item->getAuthorName() ) ) {
- $authorIPs[] = $item->getAuthorName();
+ if ( $wgActorTableSchemaMigrationStage <= MIGRATION_WRITE_BOTH ) {
+ if ( $item->getAuthorId() > 0 ) {
+ $authorIds[] = $item->getAuthorId();
+ } elseif ( IP::isIPAddress( $item->getAuthorName() ) ) {
+ $authorIPs[] = $item->getAuthorName();
+ }
+ }
+ if ( $wgActorTableSchemaMigrationStage >= MIGRATION_WRITE_BOTH ) {
+ $authorActors[] = $item->getAuthorActor();
}
// Save the old and new bits in $visibilityChangeMap for
}
// Log it
+ $authorFields = [];
+ if ( $wgActorTableSchemaMigrationStage <= MIGRATION_WRITE_BOTH ) {
+ $authorFields['authorIds'] = $authorIds;
+ $authorFields['authorIPs'] = $authorIPs;
+ }
+ if ( $wgActorTableSchemaMigrationStage >= MIGRATION_WRITE_BOTH ) {
+ $authorFields['authorActors'] = $authorActors;
+ }
$this->updateLog(
$logType,
[
'oldBits' => $virtualOldBits,
'comment' => $comment,
'ids' => $idsForLog,
- 'authorIds' => $authorIds,
- 'authorIPs' => $authorIPs,
- 'tags' => isset( $params['tags'] ) ? $params['tags'] : [],
- ]
+ 'tags' => $params['tags'] ?? [],
+ ] + $authorFields
);
// Clear caches after commit
final protected function acquireItemLocks() {
$status = Status::newGood();
- /** @var $item RevDelItem */
+ /** @var RevDelItem $item */
foreach ( $this as $item ) {
$status->merge( $item->lock() );
}
final protected function releaseItemLocks() {
$status = Status::newGood();
- /** @var $item RevDelItem */
+ /** @var RevDelItem $item */
foreach ( $this as $item ) {
$status->merge( $item->unlock() );
}
* title: The target title
* ids: The ID list
* comment: The log comment
- * authorsIds: The array of the user IDs of the offenders
- * authorsIPs: The array of the IP/anon user offenders
+ * authorIds: The array of the user IDs of the offenders
+ * authorIPs: The array of the IP/anon user offenders
+ * authorActors: The array of the actor IDs of the offenders
* tags: The array of change tags to apply to the log entry
* @throws MWException
*/
$logEntry->setParameters( $logParams );
$logEntry->setPerformer( $this->getUser() );
// Allow for easy searching of deletion log items for revision/log items
- $logEntry->setRelations( [
+ $relations = [
$field => $params['ids'],
- 'target_author_id' => $params['authorIds'],
- 'target_author_ip' => $params['authorIPs'],
- ] );
+ ];
+ if ( isset( $params['authorIds'] ) ) {
+ $relations += [
+ 'target_author_id' => $params['authorIds'],
+ 'target_author_ip' => $params['authorIPs'],
+ ];
+ }
+ if ( isset( $params['authorActors'] ) ) {
+ $relations += [
+ 'target_author_actor' => $params['authorActors'],
+ ];
+ }
+ $logEntry->setRelations( $relations );
// Apply change tags to the log entry
$logEntry->setTags( $params['tags'] );
$logId = $logEntry->insert();