X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fpage%2FWikiPage.php;h=820df58de7e36333b6e5606fdde2b38e26336332;hb=387bfb4f8e82fd94d1e43016ea2c6e54062dd169;hp=039a329be486d32bd0356f255749480ef8b75c1e;hpb=8198ea31fdca69685b284e9ba85c450dee854ca2;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 039a329be4..820df58de7 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -1781,7 +1781,7 @@ class WikiPage implements Page, IDBAccessObject { // Update recentchanges if ( !( $flags & EDIT_SUPPRESS_RC ) ) { // Mark as patrolled if the user can do so - $patrolled = $wgUseRCPatrol && !count( + $autopatrolled = $wgUseRCPatrol && !count( $this->mTitle->getUserPermissionsErrors( 'autopatrol', $user ) ); // Add RC row to the DB RecentChange::notifyEdit( @@ -1797,7 +1797,8 @@ class WikiPage implements Page, IDBAccessObject { $oldContent ? $oldContent->getSize() : 0, $newsize, $revisionId, - $patrolled, + $autopatrolled ? RecentChange::PRC_AUTOPATROLLED : + RecentChange::PRC_UNPATROLLED, $tags ); } @@ -2870,13 +2871,32 @@ class WikiPage implements Page, IDBAccessObject { // In the future, we may keep revisions and mark them with // the rev_deleted field, which is reserved for this purpose. + // Lock rows in `revision` and its temp tables, but not any others. + // Note array_intersect() preserves keys from the first arg, and we're + // assuming $revQuery has `revision` primary and isn't using subtables + // for anything we care about. + $res = $dbw->select( + array_intersect( + $revQuery['tables'], + [ 'revision', 'revision_comment_temp', 'revision_actor_temp' ] + ), + '1', + [ 'rev_page' => $id ], + __METHOD__, + 'FOR UPDATE', + $revQuery['joins'] + ); + foreach ( $res as $row ) { + // Fetch all rows in case the DB needs that to properly lock them. + } + // Get all of the page revisions $res = $dbw->select( $revQuery['tables'], $revQuery['fields'], [ 'rev_page' => $id ], __METHOD__, - 'FOR UPDATE', + [], $revQuery['joins'] ); @@ -2898,8 +2918,6 @@ class WikiPage implements Page, IDBAccessObject { 'ar_rev_id' => $row->rev_id, 'ar_parent_id' => $row->rev_parent_id, 'ar_text_id' => $row->rev_text_id, - 'ar_text' => '', - 'ar_flags' => '', 'ar_len' => $row->rev_len, 'ar_page_id' => $id, 'ar_deleted' => $suppress ? $bitfield : $row->rev_deleted, @@ -3268,7 +3286,7 @@ class WikiPage implements Page, IDBAccessObject { if ( $wgUseRCPatrol ) { // Mark all reverted edits as patrolled - $set['rc_patrolled'] = 1; + $set['rc_patrolled'] = RecentChange::PRC_PATROLLED; } if ( count( $set ) ) {