r107414 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107413‎ | r107414 | r107415 >
Date:20:32, 27 December 2011
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Simplify wrapper functions

Null (default of method) is fine to be sent as the wrapped method also uses those as default

-60 lines
Modified paths:
  • /trunk/extensions/LdapAuthentication/LdapAuthentication.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LdapAuthentication/LdapAuthentication.php
@@ -209,27 +209,7 @@
210210 */
211211 public static function ldap_search( $ldapconn, $basedn, $filter, $attributes=null, $attrsonly=null, $sizelimit=null, $timelimit=null, $deref=null ) {
212212 wfSuppressWarnings();
213 - if ( $attributes ) {
214 - if ( $attrsonly ) {
215 - if ( $sizelimit ) {
216 - if ( $timelimit ) {
217 - if ( $deref ) {
218 - $ret = ldap_search( $ldapconn, $basedn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref );
219 - } else {
220 - $ret = ldap_search( $ldapconn, $basedn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit );
221 - }
222 - } else {
223 - $ret = ldap_search( $ldapconn, $basedn, $filter, $attributes, $attrsonly, $sizelimit );
224 - }
225 - } else {
226 - $ret = ldap_search( $ldapconn, $basedn, $filter, $attributes, $attrsonly );
227 - }
228 - } else {
229 - $ret = ldap_search( $ldapconn, $basedn, $filter, $attributes );
230 - }
231 - } else {
232 - $ret = ldap_search( $ldapconn, $basedn, $filter );
233 - }
 213+ $ret = ldap_search( $ldapconn, $basedn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref );
234214 wfRestoreWarnings();
235215 return $ret;
236216 }
@@ -239,27 +219,7 @@
240220 */
241221 public static function ldap_read( $ldapconn, $basedn, $filter, $attributes=null, $attrsonly=null, $sizelimit=null, $timelimit=null, $deref=null ) {
242222 wfSuppressWarnings();
243 - if ( $attributes ) {
244 - if ( $attrsonly ) {
245 - if ( $sizelimit ) {
246 - if ( $timelimit ) {
247 - if ( $deref ) {
248 - $ret = ldap_read( $ldapconn, $basedn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref );
249 - } else {
250 - $ret = ldap_read( $ldapconn, $basedn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit );
251 - }
252 - } else {
253 - $ret = ldap_read( $ldapconn, $basedn, $filter, $attributes, $attrsonly, $sizelimit );
254 - }
255 - } else {
256 - $ret = ldap_read( $ldapconn, $basedn, $filter, $attributes, $attrsonly );
257 - }
258 - } else {
259 - $ret = ldap_read( $ldapconn, $basedn, $filter, $attributes );
260 - }
261 - } else {
262 - $ret = ldap_read( $ldapconn, $basedn, $filter );
263 - }
 223+ $ret = ldap_read( $ldapconn, $basedn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref );
264224 wfRestoreWarnings();
265225 return $ret;
266226 }
@@ -269,27 +229,7 @@
270230 */
271231 public static function ldap_list( $ldapconn, $basedn, $filter, $attributes=null, $attrsonly=null, $sizelimit=null, $timelimit=null, $deref=null ) {
272232 wfSuppressWarnings();
273 - if ( $attributes ) {
274 - if ( $attrsonly ) {
275 - if ( $sizelimit ) {
276 - if ( $timelimit ) {
277 - if ( $deref ) {
278 - $ret = ldap_list( $ldapconn, $basedn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref );
279 - } else {
280 - $ret = ldap_list( $ldapconn, $basedn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit );
281 - }
282 - } else {
283 - $ret = ldap_list( $ldapconn, $basedn, $filter, $attributes, $attrsonly, $sizelimit );
284 - }
285 - } else {
286 - $ret = ldap_list( $ldapconn, $basedn, $filter, $attributes, $attrsonly );
287 - }
288 - } else {
289 - $ret = ldap_list( $ldapconn, $basedn, $filter, $attributes );
290 - }
291 - } else {
292 - $ret = ldap_list( $ldapconn, $basedn, $filter );
293 - }
 233+ $ret = ldap_list( $ldapconn, $basedn, $filter, $attributes, $attrsonly, $sizelimit, $timelimit, $deref );
294234 wfRestoreWarnings();
295235 return $ret;
296236 }

Comments

#Comment by Reedy (talk | contribs)   20:17, 29 December 2011
function ldap_search ($link_identifier, $base_dn, $filter, array $attributes = null, $attrsonly = null, $sizelimit = null, $timelimit = null, $deref = null) {}

function ldap_read ($link_identifier, $base_dn, $filter, array $attributes = null, $attrsonly = null, $sizelimit = null, $timelimit = null, $deref = null) {}

function ldap_list ($link_identifier, $base_dn, $filter, array $attributes = null, $attrsonly = null, $sizelimit = null, $timelimit = null, $deref = null) {}

Status & tagging log