r100478 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100477‎ | r100478 | r100479 >
Date:00:16, 22 October 2011
Author:laner
Status:deferred
Tags:
Comment:
Add support for wildcard DNS.
Modified paths:
  • /trunk/extensions/OpenStackManager/OpenStackNovaHost.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNova.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNovaAddress.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenStackManager/special/SpecialNovaAddress.php
@@ -265,7 +265,7 @@
266266 $addressInfo['hostname'] = array(
267267 'type' => 'text',
268268 'default' => '',
269 - 'validation-callback' => array( $this, 'validateText' ),
 269+ 'validation-callback' => array( $this, 'validateDomain' ),
270270 'label-message' => 'openstackmanager-hostname',
271271 'name' => 'hostname',
272272 );
@@ -432,7 +432,7 @@
433433 $actions .= Html::rawElement( 'li', array(), $link );
434434 $actions = Html::rawElement( 'ul', array(), $actions );
435435 $addressOut .= Html::rawElement( 'td', array(), $actions );
436 - $projectArr["$project"] = Html::rawElement( 'tr', array(), $addressOut );
 436+ $projectArr["$project"] .= Html::rawElement( 'tr', array(), $addressOut );
437437 }
438438 foreach ( $userProjects as $project ) {
439439 $out .= Html::element( 'h2', array(), $project );
@@ -498,7 +498,7 @@
499499 if ( $success ) {
500500 $wgOut->addWikiMsg( 'openstackmanager-releasedaddress', $ip );
501501 } else {
502 - $wgOut->addWikiMsg( 'openstackmanager-releasedaddressfailed', $ip );
 502+ $wgOut->addWikiMsg( 'openstackmanager-cannotreleaseaddress', $ip );
503503 }
504504 $sk = $wgOut->getSkin();
505505 $out = '<br />';
Index: trunk/extensions/OpenStackManager/special/SpecialNova.php
@@ -69,4 +69,18 @@
7070 }
7171 }
7272
 73+ /**
 74+ * @param $resourcename
 75+ * @param $error
 76+ * @param $alldata
 77+ * @return bool|string
 78+ */
 79+ function validateDomain( $resourcename, $alldata ) {
 80+ if ( ! preg_match( "/^[a-z\*][a-z0-9\-]*$/", $resourcename ) ) {
 81+ return Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'openstackmanager-badresourcename' ) );
 82+ } else {
 83+ return true;
 84+ }
 85+ }
 86+
7387 }
Index: trunk/extensions/OpenStackManager/OpenStackNovaHost.php
@@ -55,6 +55,7 @@
5656 function fetchHostInfo() {
5757 global $wgAuth;
5858
 59+ $this->searchvalue = $wgAuth->getLdapEscapedString( $this->searchvalue );
5960 $fqdn = $this->searchvalue . '.' . $this->domain->getFullyQualifiedDomainName();
6061 wfSuppressWarnings();
6162 $result = ldap_search( $wgAuth->ldapconn, $this->domain->domainDN, '(|(associateddomain=' . $fqdn . ')(cnamerecord=' . $fqdn . ')(dc=' . $this->searchvalue . '))' );

Status & tagging log