}
// Update the DB post-send if the page has not cached since now
- $that = $this;
$latest = $this->getLatest();
DeferredUpdates::addCallableUpdate(
- function () use ( $that, $retval, $latest ) {
- $that->insertRedirectEntry( $retval, $latest );
+ function () use ( $retval, $latest ) {
+ $this->insertRedirectEntry( $retval, $latest );
},
DeferredUpdates::POSTSEND,
wfGetDB( DB_MASTER )
// Convenience variables
$now = wfTimestampNow();
$oldid = $meta['oldId'];
- /** @var $oldContent Content|null */
+ /** @var Content|null $oldContent */
$oldContent = $meta['oldContent'];
$newsize = $content->getSize();
public function doUpdateRestrictions( array $limit, array $expiry,
&$cascade, $reason, User $user, $tags = null
) {
- global $wgCascadingRestrictionLevels, $wgContLang;
+ global $wgCascadingRestrictionLevels;
if ( wfReadOnly() ) {
return Status::newFatal( wfMessage( 'readonlytext', wfReadOnlyReason() ) );
$logAction = 'protect';
}
- // Truncate for whole multibyte characters
- $reason = $wgContLang->truncate( $reason, 255 );
-
$logRelationsValues = [];
$logRelationsField = null;
$logParamsDetails = [];
'FOR UPDATE',
$commentQuery['joins']
);
+
// Build their equivalent archive rows
$rowsInsert = [];
$revids = [];
+
+ /** @var int[] Revision IDs of edits that were made by IPs */
+ $ipRevIds = [];
+
foreach ( $res as $row ) {
$comment = $revCommentStore->getComment( $row );
$rowInsert = [
}
$rowsInsert[] = $rowInsert;
$revids[] = $row->rev_id;
+
+ // Keep track of IP edits, so that the corresponding rows can
+ // be deleted in the ip_changes table.
+ if ( (int)$row->rev_user === 0 && IP::isValid( $row->rev_user_text ) ) {
+ $ipRevIds[] = $row->rev_id;
+ }
}
// Copy them into the archive table
$dbw->insert( 'archive', $rowsInsert, __METHOD__ );
$dbw->delete( 'revision_comment_temp', [ 'revcomment_rev' => $revids ], __METHOD__ );
}
+ // Also delete records from ip_changes as applicable.
+ if ( count( $ipRevIds ) > 0 ) {
+ $dbw->delete( 'ip_changes', [ 'ipc_rev_id' => $ipRevIds ], __METHOD__ );
+ }
+
// Log the deletion, if the page was suppressed, put it in the suppression log instead
$logtype = $suppress ? 'suppress' : 'delete';
// Trim spaces on user supplied text
$summary = trim( $summary );
- // Truncate for whole multibyte characters.
- $summary = $wgContLang->truncate( $summary, 255 );
-
// Save
$flags = EDIT_UPDATE | EDIT_INTERNAL;