Cenarium has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/218146

Change subject: Avoid muliple cache calls to explicitly defined tags
......................................................................

Avoid muliple cache calls to explicitly defined tags

This avoids muliple cache calls to explicitly defined tags by
calling the showTagEditUI of ChangeTags only once in logs and
histories.

Change-Id: I2e36dbd96d3fcca06de0bf418bc6dc294d8d18d3
---
M includes/actions/HistoryAction.php
M includes/logging/LogEventsList.php
2 files changed, 14 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/46/218146/1

diff --git a/includes/actions/HistoryAction.php 
b/includes/actions/HistoryAction.php
index f4f2a2a..a81adf9 100644
--- a/includes/actions/HistoryAction.php
+++ b/includes/actions/HistoryAction.php
@@ -368,6 +368,9 @@
         */
        protected $parentLens;
 
+       /** @var bool Whether to show the tag editing UI */
+       protected $showTagEditUI;
+
        /**
         * @param HistoryAction $historyPage
         * @param string $year
@@ -381,6 +384,7 @@
                $this->tagFilter = $tagFilter;
                $this->getDateCond( $year, $month );
                $this->conds = $conds;
+               $this->showTagEditUI = ChangeTags::showTagEditingUI( 
$this->getUser() );
        }
 
        // For hook compatibility...
@@ -504,7 +508,7 @@
                if ( $user->isAllowed( 'deleterevision' ) ) {
                        $actionButtons .= $this->getRevisionButton( 
'revisiondelete', 'showhideselectedversions' );
                }
-               if ( ChangeTags::showTagEditingUI( $user ) ) {
+               if ( $this->showTagEditUI ) {
                        $actionButtons .= $this->getRevisionButton( 
'editchangetags', 'history-edit-tags' );
                }
                if ( $actionButtons ) {
@@ -631,14 +635,13 @@
                $del = '';
                $user = $this->getUser();
                $canRevDelete = $user->isAllowed( 'deleterevision' );
-               $showTagEditUI = ChangeTags::showTagEditingUI( $user );
                // Show checkboxes for each revision, to allow for revision 
deletion and
                // change tags
-               if ( $canRevDelete || $showTagEditUI ) {
+               if ( $canRevDelete || $this->showTagEditUI ) {
                        $this->preventClickjacking();
                        // If revision was hidden from sysops and we don't need 
the checkbox
                        // for anything else, disable it
-                       if ( !$showTagEditUI && !$rev->userCan( 
Revision::DELETED_RESTRICTED, $user ) ) {
+                       if ( !$this->showTagEditUI && !$rev->userCan( 
Revision::DELETED_RESTRICTED, $user ) ) {
                                $del = Xml::check( 'deleterevisions', false, 
array( 'disabled' => 'disabled' ) );
                        // Otherwise, enable the checkbox...
                        } else {
diff --git a/includes/logging/LogEventsList.php 
b/includes/logging/LogEventsList.php
index dfe3136..1b56584 100644
--- a/includes/logging/LogEventsList.php
+++ b/includes/logging/LogEventsList.php
@@ -36,6 +36,11 @@
        protected $mDefaultQuery;
 
        /**
+        * @var bool
+        */
+       protected $showTagEditUI;
+
+       /**
         * Constructor.
         * The first two parameters used to be $skin and $out, but now only a 
context
         * is needed, that's why there's a second unused parameter.
@@ -55,6 +60,7 @@
                }
 
                $this->flags = $flags;
+               $this->showTagEditUI = ChangeTags::showTagEditingUI( 
$this->getUser() );
        }
 
        /**
@@ -348,7 +354,7 @@
                $user = $this->getUser();
 
                // If change tag editing is available to this user, return the 
checkbox
-               if ( $this->flags & self::USE_CHECKBOXES && 
ChangeTags::showTagEditingUI( $user ) ) {
+               if ( $this->flags & self::USE_CHECKBOXES && 
$this->showTagEditUI ) {
                        return Xml::check(
                                'showhiderevisions',
                                false,

-- 
To view, visit https://gerrit.wikimedia.org/r/218146
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2e36dbd96d3fcca06de0bf418bc6dc294d8d18d3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Cenarium <cenarium.sy...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to