From 5e7fd24297cb886f2b59a1b9c83db7e2581f31fe Mon Sep 17 00:00:00 2001 From: MusikAnimal Date: Tue, 19 Sep 2017 18:11:28 -0400 Subject: [PATCH] Don't attempt to copy to ip_changes in PageArchive class. This actually happens in Revision::insertOn, so the code is redundant, but also shouldn't ever execute because it erroneously was checking for ar_rev_id=0 and not ar_user=0. This is sometimes causing errors in production, in the rare cases where ar_rev_id is NULL, and hence (int)ar_rev_id evaluates to 0. Change-Id: I35a7310f600a9db683d7dc0e730da8ff31e337a2 --- includes/page/PageArchive.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/includes/page/PageArchive.php b/includes/page/PageArchive.php index c98d4f739d..af936cc730 100644 --- a/includes/page/PageArchive.php +++ b/includes/page/PageArchive.php @@ -734,18 +734,9 @@ class PageArchive { 'deleted' => $unsuppress ? 0 : $row->ar_deleted ] ); + // This will also copy the revision to ip_changes if it was an IP edit. $revision->insertOn( $dbw ); - // Also restore reference to the revision in ip_changes if it was an IP edit. - if ( (int)$row->ar_rev_id === 0 && IP::isValid( $row->ar_user_text ) ) { - $ipcRow = [ - 'ipc_rev_id' => $row->ar_rev_id, - 'ipc_rev_timestamp' => $row->ar_timestamp, - 'ipc_hex' => IP::toHex( $row->ar_user_text ), - ]; - $dbw->insert( 'ip_changes', $ipcRow, __METHOD__ ); - } - $restored++; Hooks::run( 'ArticleRevisionUndeleted', -- 2.20.1