r107434 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107433‎ | r107434 | r107435 >
Date:21:42, 27 December 2011
Author:laner
Status:ok
Tags:
Comment:
Add non-session based configuration lookups, based on domain. Followup to r107428.
Modified paths:
  • /trunk/extensions/LdapAuthentication/LdapAuthentication.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LdapAuthentication/LdapAuthentication.php
@@ -326,8 +326,10 @@
327327 * @param string $preference
328328 * @return mixed
329329 */
330 - public function getConf( $preference ) {
331 - $domain = $this->getSessionDomain();
 330+ public function getConf( $preference, $domain='' ) {
 331+ if ( !$domain ) {
 332+ $domain = $this->getSessionDomain();
 333+ }
332334 switch ( $preference ) {
333335 case 'ServerNames':
334336 global $wgLDAPServerNames;
@@ -532,11 +534,6 @@
533535 * @return bool
534536 */
535537 public function connect( $domain='' ) {
536 - // FIXME: $domain isn't used
537 - if ( $domain == '' ) {
538 - $domain = $this->getSessionDomain();
539 - }
540 -
541538 $this->printDebug( "Entering Connect", NONSENSITIVE );
542539
543540 if ( !function_exists( 'ldap_connect' ) ) {
@@ -547,7 +544,7 @@
548545 }
549546
550547 // Set the server string depending on whether we use ssl or not
551 - $encryptionType = $this->getConf( 'EncryptionType' );
 548+ $encryptionType = $this->getConf( 'EncryptionType', $domain );
552549 switch( $encryptionType ) {
553550 case "ldapi":
554551 $this->printDebug( "Using ldapi", SENSITIVE );
@@ -565,10 +562,10 @@
566563 // Make a space separated list of server strings with the connection type
567564 // string added.
568565 $servers = "";
569 - $tmpservers = $this->getConf( 'ServerNames' );
 566+ $tmpservers = $this->getConf( 'ServerNames', $domain );
570567 $tok = strtok( $tmpservers, " " );
571568 while ( $tok ) {
572 - $servers = $servers . " " . $serverpre . $tok . ":" . $this->getConf( 'Port' );
 569+ $servers = $servers . " " . $serverpre . $tok . ":" . $this->getConf( 'Port', $domain );
573570 $tok = strtok( " " );
574571 }
575572 $servers = rtrim( $servers );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r107428Simplify down, and don't fall through switch statements...reedy21:23, 27 December 2011

Status & tagging log