r78900 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78899‎ | r78900 | r78901 >
Date:18:12, 23 December 2010
Author:reedy
Status:deferred (Comments)
Tags:
Comment:
Fix 2 wrong method calls (missing parameters), mark one as fixme

Drop $ from start of static method call
Modified paths:
  • /trunk/extensions/OpenStackManager/OpenStackNovaDomain.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaHost.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenStackManager/OpenStackNovaHost.php
@@ -158,14 +158,14 @@
159159
160160 $domainname = $domain->getFullyQualifiedDomainName();
161161
162 - $host = new OpenStackNovaHost( $hostname );
 162+ $host = new OpenStackNovaHost( $hostname, $domain );
163163 if ( $host ) {
164164 return false;
165165 }
166166 $host = OpenStackNovaHost::getLDAPArray( $hostname, $ip, $domainname );
167167 $dn = 'dc=' . $hostname . ',dc=' . $domain->getDomainName() . ',' . $wgOpenStackManagerLDAPDNSDomainBaseDN;
168168
169 - $success = @ldap_add( $wgAuth->ldapconn, $dn, $host );
 169+ $success = @ldap_add( $wgAuth->ldapconn, $dn, $hostname );
170170 if ( $success ) {
171171 $domain->updateSOA();
172172 $wgAuth->printDebug( "Successfully added domain $domainname", NONSENSITIVE );
Index: trunk/extensions/OpenStackManager/OpenStackNovaDomain.php
@@ -49,7 +49,7 @@
5050 $hostsLDAP = ldap_get_entries( $wgAuth->ldapconn, $result );
5151 array_shift( $hostsLDAP );
5252 foreach ( $hostsLDAP as $hostLDAP ) {
53 - $hosts[] = new OpenStackNovaHost( $hostLDAP[0]['dc'] );
 53+ $hosts[] = new OpenStackNovaHost( $hostLDAP[0]['dc'] ); // FIXME: Missing constructor parameter
5454 }
5555
5656 return $hosts;
@@ -58,7 +58,7 @@
5959 function updateSOA() {
6060 global $wgAuth;
6161
62 - $domain['soarecord'] = $OpenStackNovaDomain::generateSOA();
 62+ $domain['soarecord'] = OpenStackNovaDomain::generateSOA();
6363 $success = @ldap_modify( $wgAuth->ldapconn, $this->domainDN, $domain );
6464 if ( $success ) {
6565 $wgAuth->printDebug( "Successfully modified soarecord for " . $this->domainDN, NONSENSITIVE );

Comments

#Comment by Ryan lane (talk | contribs)   22:17, 23 December 2010

$success = @ldap_add( $wgAuth->ldapconn, $dn, $host );

was actually correct :). Will fix in a newer commit.

#Comment by Catrope (talk | contribs)   23:10, 23 December 2010

Don't use @, use wfSuppressWarnings() and wfRestoreWarnings()

#Comment by Zakgreant (talk | contribs)   23:32, 23 December 2010

I've dropped a note to this effect at http://www.mediawiki.org/wiki/Manual:Coding_conventions#Error_handling – we may want to move it to a better location.

#Comment by Ryan lane (talk | contribs)   17:39, 27 December 2010

Fixed in r79076.

Status & tagging log