Don't attempt to copy to ip_changes in PageArchive class.
authorMusikAnimal <musikanimal@gmail.com>
Tue, 19 Sep 2017 22:11:28 +0000 (18:11 -0400)
committerMusikAnimal <musikanimal@gmail.com>
Tue, 19 Sep 2017 22:13:56 +0000 (18:13 -0400)
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

index c98d4f7..af936cc 100644 (file)
@@ -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',