From: umherirrender Date: Fri, 13 Jul 2012 13:40:18 +0000 (+0200) Subject: Exception on Special:NewFiles, when no bot group is defined X-Git-Tag: 1.31.0-rc.0~23055^2 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=f1ceea6dc8337bb57f2309e09e79726d61b2000c;p=lhc%2Fweb%2Fwiklou.git Exception on Special:NewFiles, when no bot group is defined When no user group has the permission 'bot', the list is empty and Database::makeList throws an exception Change-Id: I7ac5863ef22b1454857399b0cff52850eca7d3b8 --- diff --git a/includes/specials/SpecialNewimages.php b/includes/specials/SpecialNewimages.php index 45dbd36d6b..35f39cec7f 100644 --- a/includes/specials/SpecialNewimages.php +++ b/includes/specials/SpecialNewimages.php @@ -68,15 +68,18 @@ class NewFilesPager extends ReverseChronologicalPager { $tables = array( 'image' ); if( !$this->showbots ) { - $tables[] = 'user_groups'; - $conds[] = 'ug_group IS NULL'; - $jconds['user_groups'] = array( - 'LEFT JOIN', - array( - 'ug_group' => User::getGroupsWithPermission( 'bot' ), - 'ug_user = img_user' - ) - ); + $groupsWithBotPermission = User::getGroupsWithPermission( 'bot' ); + if( count( $groupsWithBotPermission ) ) { + $tables[] = 'user_groups'; + $conds[] = 'ug_group IS NULL'; + $jconds['user_groups'] = array( + 'LEFT JOIN', + array( + 'ug_group' => $groupsWithBotPermission, + 'ug_user = img_user' + ) + ); + } } if( !$wgMiserMode && $this->like !== null ){