r84646 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84645‎ | r84646 | r84647 >
Date:00:02, 24 March 2011
Author:reedy
Status:deferred
Tags:
Comment:
validateInstanceName and validateHostName are exact duplicates seemingly

Move into parent SpecialNova class
Modified paths:
  • /trunk/extensions/OpenStackManager/special/SpecialNova.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNovaAddress.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNovaInstance.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenStackManager/special/SpecialNovaInstance.php
@@ -700,20 +700,6 @@
701701 $wgOut->addHTML( $out );
702702 return true;
703703 }
704 -
705 - /**
706 - * @param $instancename
707 - * @param $alldata
708 - * @return bool|string
709 - */
710 - function validateInstanceName( $instancename, $alldata ) {
711 - if ( ! preg_match( "/^[a-z][a-z0-9\-]*$/", $instancename ) ) {
712 - return Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'openstackmanager-badinstancename' ) );
713 - } else {
714 - return true;
715 - }
716 - }
717 -
718704 }
719705
720706 class SpecialNovaInstanceForm extends HTMLForm {
Index: trunk/extensions/OpenStackManager/special/SpecialNovaAddress.php
@@ -664,19 +664,6 @@
665665 $wgOut->addHTML( $out );
666666 return true;
667667 }
668 -
669 - /**
670 - * @param $hostname
671 - * @param $alldata
672 - * @return bool|string
673 - */
674 - function validateHostName( $hostname, $alldata ) {
675 - if ( ! preg_match( "/^[a-z][a-z0-9\-]*$/", $hostname ) ) {
676 - return Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'openstackmanager-badinstancename' ) );
677 - } else {
678 - return true;
679 - }
680 - }
681668 }
682669
683670 class SpecialNovaAddressForm extends HTMLForm {
Index: trunk/extensions/OpenStackManager/special/SpecialNova.php
@@ -54,4 +54,17 @@
5555 $wgOut->addWikiMsg( 'openstackmanager-needcloudadminrole2' );
5656 }
5757 }
 58+
 59+ /**
 60+ * @param $hostname
 61+ * @param $alldata
 62+ * @return bool|string
 63+ */
 64+ function validateHostName( $hostname, $alldata ) {
 65+ if ( ! preg_match( "/^[a-z][a-z0-9\-]*$/", $hostname ) ) {
 66+ return Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'openstackmanager-badinstancename' ) );
 67+ } else {
 68+ return true;
 69+ }
 70+ }
5871 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r84986Follow up to r84646. Changed the validation callbacks to point to the correct...laner22:28, 29 March 2011

Status & tagging log