r84648 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84647‎ | r84648 | r84649 >
Date:00:13, 24 March 2011
Author:reedy
Status:deferred
Tags:
Comment:
Remove some more duplicate code, factor down to SpecialNova general purpose method

Remove some unused paramters, and hence, their callers
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)
  • /trunk/extensions/OpenStackManager/special/SpecialNovaProject.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNovaVolume.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenStackManager/special/SpecialNovaAddress.php
@@ -578,7 +578,7 @@
579579 $domain = $formData['domain'];
580580 $domain = OpenStackNovaDomain::getDomainByName( $domain );
581581 $hostbyname = OpenStackNovaHost::getHostByName( $hostname, $domain );
582 - $hostbyip = OpenStackNovaHost::getHostByIP( $ip, $domain );
 582+ $hostbyip = OpenStackNovaHost::getHostByIP( $ip );
583583
584584 if ( $hostbyname ) {
585585 # We need to add an arecord, if the arecord doesn't already exist
Index: trunk/extensions/OpenStackManager/special/SpecialNovaProject.php
@@ -376,19 +376,6 @@
377377 return true;
378378 }
379379
380 - /**
381 - * @param $projectname
382 - * @param $alldata
383 - * @return bool|string
384 - */
385 - function validateProjectName( $projectname, $alldata ) {
386 - if ( !preg_match( "/^[a-z][a-z0-9\-_]*$/", $projectname ) ) {
387 - return Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'openstackmanager-badprojectname' ) );
388 - } else {
389 - return true;
390 - }
391 - }
392 -
393380 }
394381
395382 class SpecialNovaProjectForm extends HTMLForm {
Index: trunk/extensions/OpenStackManager/special/SpecialNovaVolume.php
@@ -518,20 +518,6 @@
519519
520520 return $drives;
521521 }
522 -
523 - /**
524 - * @param $volumename
525 - * @param $alldata
526 - * @return bool|string
527 - */
528 - function validateVolumeName( $volumename, $alldata ) {
529 - if ( ! preg_match( "/^[a-z][a-z0-9\-]*$/", $volumename ) ) {
530 - return Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'openstackmanager-badvolumename' ) );
531 - } else {
532 - return true;
533 - }
534 - }
535 -
536522 }
537523
538524 class SpecialNovaVolumeForm extends HTMLForm {
Index: trunk/extensions/OpenStackManager/special/SpecialNova.php
@@ -57,14 +57,14 @@
5858
5959 /**
6060 * @param $hostname
61 - * @param $alldata
6261 * @return bool|string
6362 */
64 - function validateHostName( $hostname, $alldata ) {
 63+ function validateText( $hostname, $error ) {
6564 if ( ! preg_match( "/^[a-z][a-z0-9\-]*$/", $hostname ) ) {
66 - return Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'openstackmanager-badinstancename' ) );
 65+ return Xml::element( 'span', array( 'class' => 'error' ), wfMsg( $error ) );
6766 } else {
6867 return true;
6968 }
7069 }
 70+
7171 }
Index: trunk/extensions/OpenStackManager/OpenStackNovaHost.php
@@ -420,10 +420,9 @@
421421 *
422422 * @static
423423 * @param $ip
424 - * @param $domain OpenStackNovaDomain
425424 * @return null|OpenStackNovaHost
426425 */
427 - static function getHostByIP( $ip, $domain ) {
 426+ static function getHostByIP( $ip ) {
428427 global $wgAuth;
429428 global $wgOpenStackManagerLDAPInstanceBaseDN;
430429

Status & tagging log