Yaron Koren has submitted this change and it was merged.

Change subject: MW 1.27 fix for Special:ViewData
......................................................................


MW 1.27 fix for Special:ViewData

Change-Id: I58b6479dcb83943a408adb2d3dfaf203ff5aa296
---
M specials/CargoViewData.php
1 file changed, 12 insertions(+), 5 deletions(-)

Approvals:
  Yaron Koren: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/specials/CargoViewData.php b/specials/CargoViewData.php
index c940e1c..095e1a2 100644
--- a/specials/CargoViewData.php
+++ b/specials/CargoViewData.php
@@ -161,15 +161,22 @@
                // "order by" is handled elsewhere, in getOrderFields().
                //
                // Field aliases need to have quotes placed around them
-               // before actually running the query.
-               $realAliasedFieldNames = array();
-               foreach ( $this->sqlQuery->mAliasedFieldNames as $alias => 
$fieldName ) {
-                       $realAliasedFieldNames['"' . $alias . '"'] = $fieldName;
+               // before running the query - though, starting in
+               // MW 1.27 (specifically, with
+               // https://gerrit.wikimedia.org/r/#/c/286489/),
+               // the quotes get added automatically.
+               if ( version_compare( $GLOBALS['wgVersion'], '1.27', '<' ) ) {
+                       $aliasedFieldNames = array();
+                       foreach ( $this->sqlQuery->mAliasedFieldNames as $alias 
=> $fieldName ) {
+                               $aliasedFieldNames['"' . $alias . '"'] = 
$fieldName;
+                       }
+               } else {
+                       $aliasedFieldNames = 
$this->sqlQuery->mAliasedFieldNames;
                }
 
                $queryInfo = array(
                        'tables' => $this->sqlQuery->mTableNames,
-                       'fields' => $realAliasedFieldNames,
+                       'fields' => $aliasedFieldNames,
                        'options' => $selectOptions
                );
                if ( $this->sqlQuery->mWhereStr != '' ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I58b6479dcb83943a408adb2d3dfaf203ff5aa296
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <yaro...@gmail.com>
Gerrit-Reviewer: Yaron Koren <yaro...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to