Hoo man has uploaded a new change for review.

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

Change subject: Only select fields we need in WikiPageEntityRevisionLookup
......................................................................

Only select fields we need in WikiPageEntityRevisionLookup

Change-Id: I765b68e768ba1bc6ad1f59707b2df1e54bcaf10b
---
M lib/includes/store/sql/WikiPageEntityRevisionLookup.php
1 file changed, 18 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/00/178700/1

diff --git a/lib/includes/store/sql/WikiPageEntityRevisionLookup.php 
b/lib/includes/store/sql/WikiPageEntityRevisionLookup.php
index c84f503..45b7d31 100644
--- a/lib/includes/store/sql/WikiPageEntityRevisionLookup.php
+++ b/lib/includes/store/sql/WikiPageEntityRevisionLookup.php
@@ -148,6 +148,22 @@
        }
 
        /**
+        * Fields we need to select to load a revision
+        *
+        * @return string[]
+        */
+       private function selectFields() {
+               return array(
+                       'rev_id',
+                       'rev_content_format',
+                       'rev_timestamp',
+                       'old_id',
+                       'old_text',
+                       'old_flags'
+               );
+       }
+
+       /**
         * Selects revision information from the page, revision, and text 
tables.
         *
         * @since 0.4
@@ -159,7 +175,7 @@
         * @throws DBQueryError If the query fails.
         * @return object|null a raw database row object, or null if no such 
entity revision exists.
         */
-       protected function selectRevisionRow( EntityId $entityId, $revisionId = 
0, $connType = DB_SLAVE ) {
+       private function selectRevisionRow( EntityId $entityId, $revisionId = 
0, $connType = DB_SLAVE ) {
                wfProfileIn( __METHOD__ );
                $db = $this->getConnection( $connType );
 
@@ -172,8 +188,6 @@
                $pageTable = $db->tableName( 'page' );
                $revisionTable = $db->tableName( 'revision' );
                $textTable = $db->tableName( 'text' );
-
-               $vars = "$pageTable.*, $revisionTable.*, $textTable.*";
 
                $where = array();
                $join = array();
@@ -211,7 +225,7 @@
                        wfDebugLog( __CLASS__, __FUNCTION__ . ': Looking up 
latest revision of ' . $entityId );
                }
 
-               $res = $db->select( $tables, $vars, $where, __METHOD__, 
array(), $join );
+               $res = $db->select( $tables, $this->selectFields(), $where, 
__METHOD__, array(), $join );
 
                if ( !$res ) {
                        // this can only happen if the DB is set to ignore 
errors, which shouldn't be the case...

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I765b68e768ba1bc6ad1f59707b2df1e54bcaf10b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Hoo man <[email protected]>

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

Reply via email to