Aude has uploaded a new change for review.

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


Change subject: Split code for loading revision tags into separate functions
......................................................................

Split code for loading revision tags into separate functions

Change-Id: I0916f4a4104172f67ec8d543d9bb9efa0311469b
---
M includes/diff/DifferenceEngine.php
1 file changed, 29 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/48/92348/1

diff --git a/includes/diff/DifferenceEngine.php 
b/includes/diff/DifferenceEngine.php
index ea74164..6b40df9 100644
--- a/includes/diff/DifferenceEngine.php
+++ b/includes/diff/DifferenceEngine.php
@@ -1150,29 +1150,40 @@
                        $this->mOldPage = $this->mOldRev->getTitle();
                }
 
-               // Load tags information for both revisions
-               $dbr = wfGetDB( DB_SLAVE );
-               if ( $this->mOldid !== false ) {
-                       $this->mOldTags = $dbr->selectField(
-                               'tag_summary',
-                               'ts_tags',
-                               array( 'ts_rev_id' => $this->mOldid ),
-                               __METHOD__
-                       );
-               } else {
-                       $this->mOldTags = false;
-               }
-               $this->mNewTags = $dbr->selectField(
-                       'tag_summary',
-                       'ts_tags',
-                       array( 'ts_rev_id' => $this->mNewid ),
-                       __METHOD__
-               );
+               $this->loadRevisionTags();
 
                return true;
        }
 
        /**
+        * Load tags information for both revisions
+        */
+       protected function loadRevisionTags() {
+               $this->mOldTags = $this->getRevisionTags( $this->mOldId );
+               $this->mNewTags = $this->getRevisionTags( $this->mNewId );
+       }
+
+       /**
+        * Get revision tags for a revision id
+        *
+        * @return bool|mixed
+        */
+       protected function getRevisionTags( $revId ) {
+               if ( $revId !== false ) {
+                       $dbr = wfGetDB( DB_SLAVE );
+
+                       return $dbr->selectField(
+                               'tag_summary',
+                               'ts_tags',
+                               array( 'ts_rev_id' => $revId ),
+                               __METHOD__
+                       );
+               }
+
+               return false;
+       }
+
+       /**
         * Load the text of the revisions, as well as revision data.
         *
         * @return bool

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0916f4a4104172f67ec8d543d9bb9efa0311469b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aude <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to