Pwirth has uploaded a new change for review.
https://gerrit.wikimedia.org/r/168058
Change subject: Fixed namespace filter in SmartList (toplist)
......................................................................
Fixed namespace filter in SmartList (toplist)
* fixed query (in instead of =)
* fixed empty clause (string 0 is empty)
* added TODO
Change-Id: I80f663993760d5ac6dc9b645a18233a334473d4c
---
M SmartList/SmartList.class.php
1 file changed, 9 insertions(+), 11 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions
refs/changes/58/168058/1
diff --git a/SmartList/SmartList.class.php b/SmartList/SmartList.class.php
index 1529c2b..1457199 100644
--- a/SmartList/SmartList.class.php
+++ b/SmartList/SmartList.class.php
@@ -993,7 +993,7 @@
$iCount = BsCore::sanitizeArrayEntry( $aArgs, 'count',
10, BsPARAMTYPE::INT );
$sPeriod = BsCore::sanitizeArrayEntry( $aArgs, 'period',
'alltime', BsPARAMTYPE::STRING );
$iPortletPeriod = BsCore::sanitizeArrayEntry( $aArgs,
'portletperiod', 0, BsPARAMTYPE::INT );
- $bAlltime = true;
+ $bAlltime = true; //TODO: Find out what this is for
$oDbr = wfGetDB( DB_SLAVE );
if ( in_array( $sPeriod, array( 'week', 'month' ) ) ||
in_array( $iPortletPeriod, array( 7, 30 ) ) ) {
@@ -1044,18 +1044,16 @@
}
}
- if ( !empty( $sNs ) ) {
- $iNamespaces =
BsNamespaceHelper::getNamespaceIdsFromAmbiguousCSVString( $sNs );
- if ( is_array( $iNamespaces ) ) {
- foreach ( $iNamespaces as $iNamespace ) {
- if ( $bAlltime === false ) {
-
$aConditions['wo_page_namespace'] = $iNamespace;
- } else {
- $aConditions['page_namespace']
= $iNamespace;
- }
- }
+ if ( !empty( $sNs ) || $sNs === '0') { // string 0 is empty
+ $aNamespaces =
BsNamespaceHelper::getNamespaceIdsFromAmbiguousCSVString( $sNs );
+ if ( !empty( $aNamespaces ) ) {
+ $bAlltime === false
+ ? $aConditions['wo_page_namespace'] =
$aNamespaces
+ : $aConditions['page_namespace'] =
$aNamespaces
+ ;
}
}
+
$res = $oDbr->select(
$aTables,
$aColumns,
--
To view, visit https://gerrit.wikimedia.org/r/168058
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I80f663993760d5ac6dc9b645a18233a334473d4c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Pwirth <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits