ItSpiderman has uploaded a new change for review.

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

Change subject: Small fixes
......................................................................

Small fixes

Change-Id: I2a49ab2d7024cc93c31b3bbb4a7313e581fd91ab
---
M ExtendedSearch/includes/Handler/TagCloudSearchStatsHandler.class.php
1 file changed, 8 insertions(+), 5 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions 
refs/changes/98/322098/1

diff --git 
a/ExtendedSearch/includes/Handler/TagCloudSearchStatsHandler.class.php 
b/ExtendedSearch/includes/Handler/TagCloudSearchStatsHandler.class.php
index 017865f..0354190 100644
--- a/ExtendedSearch/includes/Handler/TagCloudSearchStatsHandler.class.php
+++ b/ExtendedSearch/includes/Handler/TagCloudSearchStatsHandler.class.php
@@ -33,12 +33,12 @@
       'count' => 'COUNT(stats_term)'
     );
 
-    $iTimeSpan = 1;
+    $sTimeSpan = "1 month";
     if ( !empty( $aOptions['timespan'] ) ) {
-      $iTimeSpan = ( int )$aOptions['timespan'];
+      $sTimeSpan = $aOptions['timespan'];
     }
 
-    $sStartDate = wfTimestamp( TS_MW, strtotime( "-$iTimeSpan months" ) );
+    $sStartDate = wfTimestamp( TS_MW, strtotime( '-'.$sTimeSpan ) );
 
     $aConditions = array();
     $aConditions[] = "stats_ts >= $sStartDate";
@@ -50,10 +50,13 @@
 
     $aQueryOptions = array(
       'GROUP BY' => 'stats_term',
-      'LIMIT' => $aOptions['count'],
-      'ORDER BY' => 'COUNT(stats_term)'
+      'ORDER BY' => 'COUNT(stats_term) DESC'
     );
 
+    if ( $aOptions['count'] != -1 ) {
+      $aQueryOptions['LIMIT'] = $aOptions["count"];
+    }
+
     $oRes = $oDB->select(
         $aTables,
         $aFields,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2a49ab2d7024cc93c31b3bbb4a7313e581fd91ab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: REL1_23
Gerrit-Owner: ItSpiderman <[email protected]>

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

Reply via email to