From ede90ac05abc60bc87d59b27711cbc63f8cf899f Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Thu, 27 Dec 2012 03:28:17 -0400 Subject: [PATCH] (bug 39062) Show revs without rev_parent_id in Special:Contributions. This is a follow-up to Ifd63cdf1 (c8e0ec3f) Currently if rev_parent_id is not populated on a row we just output an empty bullet -
  • . (Which can happen if an update is performed properly. There are (were?) some examples of this on en wikipedia. I was just talking to a user who had some of his revisions not be populated for that field, so it can happen.) Heck there's even code that checks for this case inside the if statement (before this commit) that stops non rev_parent_id rows from being processed. This seems very very wrong to me. Change the check for if a revision is valid to look for rev_id (which is the primary key, so going to be there, and always has been there). Also in the case we don't have a valid revision and can't format it (For example, an ext made a hook that added random rows to the Special:Contribs query, but forgot to format some), instead of outputting an empty bullet, output just an html comment, (and a debug log entry). Thank you to Isarra for reporting this issue. Change-Id: I7ef562d6e829877dd8ea4ffb1e7e04b46c943ec1 --- RELEASE-NOTES-1.21 | 2 ++ includes/specials/SpecialContributions.php | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES-1.21 b/RELEASE-NOTES-1.21 index e04cb8ee27..6859bdadb1 100644 --- a/RELEASE-NOTES-1.21 +++ b/RELEASE-NOTES-1.21 @@ -125,6 +125,8 @@ production. History page. * (bug 42949) API no longer assumes all exceptions are MWException. * (bug 41733) Hide "New user message" (.usermessage) element from printable view. +* (bug 39062) Special:Contributions will display changes that don't have + a parent id instead of just an empty bullet item. === API changes in 1.21 === * prop=revisions can now report the contentmodel and contentformat. diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index c58d4da1a2..b6fea0212c 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -827,7 +827,7 @@ class ContribsPager extends ReverseChronologicalPager { */ wfSuppressWarnings(); $rev = new Revision( $row ); - $validRevision = $rev->getParentId() !== null; + $validRevision = (bool) $rev->getId(); wfRestoreWarnings(); if ( $validRevision ) { @@ -947,7 +947,12 @@ class ContribsPager extends ReverseChronologicalPager { wfRunHooks( 'ContributionsLineEnding', array( $this, &$ret, $row, &$classes ) ); $classes = implode( ' ', $classes ); - $ret = "
  • $ret
  • \n"; + if ( $classes === '' && $ret === '' ) { + wfDebug( 'Dropping Special:Contribution row that could not be formatted' ); + $ret = "\n"; + } else { + $ret = "
  • $ret
  • \n"; + } wfProfileOut( __METHOD__ ); return $ret; -- 2.20.1