jenkins-bot has submitted this change and it was merged.
Change subject: (bug 25592) LogEventsList:showLogExtract should ignore
WebRequest
......................................................................
(bug 25592) LogEventsList:showLogExtract should ignore WebRequest
LogEventsList:showLogExtract currently pays attention to WebRequest
parameters such as offset, dir, order, and limit (although limit is
typically overridden by callers, and offset sometimes too).
While these make sense for a pager that is driving the whole page, it
doesn't make much sense for the "most recent log entry" boxes that are
displayed using LogEventsList:showLogExtract. So let's have
LogEventsList:showLogExtract ignore these, and for good measure add in a
parameter to use the old behavior in case any caller really needs that.
Change-Id: Id4380cd863ba69fc9b9afb5a0034d82ad4d9cc34
---
M RELEASE-NOTES-1.22
M includes/logging/LogEventsList.php
2 files changed, 15 insertions(+), 1 deletion(-)
Approvals:
Anomie: Looks good to me, approved
jenkins-bot: Verified
diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22
index 13a3c3c..cf31e51 100644
--- a/RELEASE-NOTES-1.22
+++ b/RELEASE-NOTES-1.22
@@ -31,6 +31,10 @@
by adding a new configuration variable $wgApplyIpBlocksToXff (disabled by
default).
* The new hook 'APIGetPossibleErrors' to modify the list of possible errors was
added.
+* (bug 25592) LogEventsList::showLogExtract() will now ignore various
+ Pager-related WebRequest parameters by default, as this is overwhelmingly
+ likely to be what was intended by users of the method. If any caller wishes
+ to use these parameters, the new param 'useRequestParams' may be set to true.
=== Bug fixes in 1.22 ===
* Disable Special:PasswordReset when $wgEnableEmail. Previously one could still
diff --git a/includes/logging/LogEventsList.php
b/includes/logging/LogEventsList.php
index ba48bd7..7025332 100644
--- a/includes/logging/LogEventsList.php
+++ b/includes/logging/LogEventsList.php
@@ -464,6 +464,7 @@
* set to '' to unset offset
* - wrap String Wrap the message in html (usually something like "<div
...>$1</div>").
* - flags Integer display flags (NO_ACTION_LINK,NO_EXTRA_USER_LINKS)
+ * - useRequestParams boolean Set true to use Pager-related parameters
in the WebRequest
* @return Integer Number of total log items (not limited by $lim)
*/
public static function showLogExtract(
@@ -475,7 +476,8 @@
'showIfEmpty' => true,
'msgKey' => array( '' ),
'wrap' => "$1",
- 'flags' => 0
+ 'flags' => 0,
+ 'useRequestParams' => false,
);
# The + operator appends elements of remaining keys from the
right
# handed array to the left handed, whereas duplicated keys are
NOT overwritten.
@@ -487,6 +489,7 @@
$msgKey = $param['msgKey'];
$wrap = $param['wrap'];
$flags = $param['flags'];
+ $useRequestParams = $param['useRequestParams'];
if ( !is_array( $msgKey ) ) {
$msgKey = array( $msgKey );
}
@@ -500,6 +503,13 @@
# Insert list of top 50 (or top $lim) items
$loglist = new LogEventsList( $context, null, $flags );
$pager = new LogPager( $loglist, $types, $user, $page, '',
$conds );
+ if ( !$useRequestParams ) {
+ # Reset vars that may have been taken from the request
+ $pager->mLimit = 50;
+ $pager->mDefaultLimit = 50;
+ $pager->mOffset = "";
+ $pager->mIsBackwards = false;
+ }
if ( isset( $param['offset'] ) ) { # Tell pager to ignore
WebRequest offset
$pager->setOffset( $param['offset'] );
}
--
To view, visit https://gerrit.wikimedia.org/r/47200
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id4380cd863ba69fc9b9afb5a0034d82ad4d9cc34
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: IAlex <[email protected]>
Gerrit-Reviewer: MZMcBride <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits