From: Brian Wolff Date: Sat, 16 Nov 2013 22:57:33 +0000 (-0400) Subject: Use master db for showing log extract on RevDel success page X-Git-Tag: 1.31.0-rc.0~17097 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=a2cd62c67703fdc4f13c881032a9d453cfc00777;p=lhc%2Fweb%2Fwiklou.git Use master db for showing log extract on RevDel success page On revision delete success, we show an excerpt from the log, it is very confusing when that excerpt doesn't include the action that you just did. Bug: 57033 Change-Id: Ica79bf76243f7ab7a2a0fb40689c34bd2ffc0297 --- diff --git a/includes/logging/LogEventsList.php b/includes/logging/LogEventsList.php index ead418d93a..f0f297fd40 100644 --- a/includes/logging/LogEventsList.php +++ b/includes/logging/LogEventsList.php @@ -502,6 +502,7 @@ class LogEventsList extends ContextSource { * - wrap String Wrap the message in html (usually something like "
$1
"). * - flags Integer display flags (NO_ACTION_LINK,NO_EXTRA_USER_LINKS) * - useRequestParams boolean Set true to use Pager-related parameters in the WebRequest + * - useMaster boolean Use master DB * @return int Number of total log items (not limited by $lim) */ public static function showLogExtract( @@ -515,6 +516,7 @@ class LogEventsList extends ContextSource { 'wrap' => "$1", 'flags' => 0, 'useRequestParams' => false, + 'useMaster' => false, ); # The + operator appends elements of remaining keys from the right # handed array to the left handed, whereas duplicated keys are NOT overwritten. @@ -548,6 +550,9 @@ class LogEventsList extends ContextSource { $pager->mIsBackwards = false; } + if ( $param['useMaster'] ) { + $pager->mDb = wfGetDB( DB_MASTER ); + } if ( isset( $param['offset'] ) ) { # Tell pager to ignore WebRequest offset $pager->setOffset( $param['offset'] ); } diff --git a/includes/specials/SpecialRevisiondelete.php b/includes/specials/SpecialRevisiondelete.php index 804f7a943f..3599dc6260 100644 --- a/includes/specials/SpecialRevisiondelete.php +++ b/includes/specials/SpecialRevisiondelete.php @@ -55,6 +55,9 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { /** The RevDel_List object, storing the list of items to be deleted/undeleted */ var $list; + /** Was the DB modified in this request */ + protected $wasSaved = false; + /** * UI labels for each type. */ @@ -177,14 +180,24 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { # Show relevant lines from the deletion log $deleteLogPage = new LogPage( 'delete' ); $output->addHTML( "

" . $deleteLogPage->getName()->escaped() . "

\n" ); - LogEventsList::showLogExtract( $output, 'delete', - $this->targetObj, '', array( 'lim' => 25, 'conds' => $qc ) ); + LogEventsList::showLogExtract( + $output, + 'delete', + $this->targetObj, + '', /* user */ + array( 'lim' => 25, 'conds' => $qc, 'useMaster' => $this->wasSaved ) + ); # Show relevant lines from the suppression log if ( $user->isAllowed( 'suppressionlog' ) ) { $suppressLogPage = new LogPage( 'suppress' ); $output->addHTML( "

" . $suppressLogPage->getName()->escaped() . "

\n" ); - LogEventsList::showLogExtract( $output, 'suppress', - $this->targetObj, '', array( 'lim' => 25, 'conds' => $qc ) ); + LogEventsList::showLogExtract( + $output, + 'suppress', + $this->targetObj, + '', + array( 'lim' => 25, 'conds' => $qc, 'useMaster' => $this->wasSaved ) + ); } } @@ -523,6 +536,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { protected function success() { $this->getOutput()->setPageTitle( $this->msg( 'actioncomplete' ) ); $this->getOutput()->wrapWikiMsg( "\n$1\n", $this->typeLabels['success'] ); + $this->wasSaved = true; $this->list->reloadFromMaster(); $this->showForm(); }