r108896 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108895‎ | r108896 | r108897 >
Date:12:01, 14 January 2012
Author:petrb
Status:reverted (Comments)
Tags:openstack 
Comment:
Added check if MEDIAWIKI is definied to avoid execution outside of mw, inserted some comments to header, should contain more info about each files,
so that people can know what file is for what
Modified paths:
  • /trunk/extensions/OpenStackManager/OpenStackNovaAddress.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaArticle.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaController.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaDomain.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaHost.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaHostJob.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaImage.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaInstance.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaInstanceType.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaKeypair.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaLdapConnection.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaProject.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaPuppetGroup.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaRole.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaSecurityGroup.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaSudoer.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaUser.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaVolume.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNova.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNovaAddress.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNovaDomain.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNovaInstance.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNovaKey.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNovaProject.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNovaPuppetGroup.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNovaRole.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNovaSecurityGroup.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNovaSudoer.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNovaVolume.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenStackManager/special/SpecialNovaInstance.php
@@ -1,4 +1,17 @@
22 <?php
 3+
 4+/**
 5+ * special for nova instance
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
316 class SpecialNovaInstance extends SpecialNova {
417
518 /**
Index: trunk/extensions/OpenStackManager/special/SpecialNovaSecurityGroup.php
@@ -1,4 +1,17 @@
22 <?php
 3+
 4+/**
 5+ * todo comment me
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
316 class SpecialNovaSecurityGroup extends SpecialNova {
417
518 /**
Index: trunk/extensions/OpenStackManager/special/SpecialNovaAddress.php
@@ -1,4 +1,17 @@
22 <?php
 3+
 4+/**
 5+ * Special page from nova address
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
316 class SpecialNovaAddress extends SpecialNova {
417
518 var $adminNova;
Index: trunk/extensions/OpenStackManager/special/SpecialNovaProject.php
@@ -1,4 +1,17 @@
22 <?php
 3+
 4+/**
 5+ * To do: comment me
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
316 class SpecialNovaProject extends SpecialNova {
417
518 var $adminNova;
Index: trunk/extensions/OpenStackManager/special/SpecialNovaDomain.php
@@ -1,4 +1,17 @@
22 <?php
 3+
 4+/**
 5+ * Special page from nova domain
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
316 class SpecialNovaDomain extends SpecialNova {
417
518 var $adminNova;
Index: trunk/extensions/OpenStackManager/special/SpecialNovaVolume.php
@@ -1,4 +1,17 @@
22 <?php
 3+
 4+/**
 5+ * todo comment me
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
316 class SpecialNovaVolume extends SpecialNova {
417
518 /**
Index: trunk/extensions/OpenStackManager/special/SpecialNovaKey.php
@@ -1,4 +1,17 @@
22 <?php
 3+
 4+/**
 5+ * special page for nova key
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
316 class SpecialNovaKey extends SpecialNova {
417
518 var $userNova;
Index: trunk/extensions/OpenStackManager/special/SpecialNovaPuppetGroup.php
@@ -1,4 +1,17 @@
22 <?php
 3+
 4+/**
 5+ * todo comment me
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
316 class SpecialNovaPuppetGroup extends SpecialNova {
417
518 function __construct() {
Index: trunk/extensions/OpenStackManager/special/SpecialNova.php
@@ -1,5 +1,17 @@
22 <?php
33
 4+/**
 5+ * Special page for nova
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
416 abstract class SpecialNova extends SpecialPage {
517
618 /**
Index: trunk/extensions/OpenStackManager/special/SpecialNovaRole.php
@@ -1,4 +1,17 @@
22 <?php
 3+
 4+/**
 5+ * todo comment me
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
316 class SpecialNovaRole extends SpecialNova {
417
518 var $adminNova;
Index: trunk/extensions/OpenStackManager/special/SpecialNovaSudoer.php
@@ -1,4 +1,17 @@
22 <?php
 3+
 4+/**
 5+ * todo comment me
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
316 class SpecialNovaSudoer extends SpecialNova {
417
518 var $userLDAP;
Index: trunk/extensions/OpenStackManager/OpenStackNovaLdapConnection.php
@@ -1,5 +1,17 @@
22 <?php
33
 4+/**
 5+ * class for nova ldap
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
416 class OpenStackNovaLdapConnection {
517
618 /**
Index: trunk/extensions/OpenStackManager/OpenStackNovaSudoer.php
@@ -1,5 +1,17 @@
22 <?php
33
 4+/**
 5+ * class for nova sudoers
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
416 class OpenStackNovaSudoer {
517
618 var $sudoername;
Index: trunk/extensions/OpenStackManager/OpenStackNovaRole.php
@@ -1,5 +1,17 @@
22 <?php
33
 4+/**
 5+ * todo comment me
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
416 class OpenStackNovaRole {
517
618 var $rolename;
@@ -10,7 +22,7 @@
1123
1224 /**
1325 * @param $rolename
14 - * @param null $project
 26+ * @param null $project, optional
1527 */
1628 function __construct( $rolename, $project=null ) {
1729 $this->rolename = $rolename;
Index: trunk/extensions/OpenStackManager/OpenStackNovaInstance.php
@@ -1,5 +1,17 @@
22 <?php
33
 4+/**
 5+ * class for NovaInstance
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
416 # TODO: Make this an abstract class, and make the EC2 API a subclass
517 class OpenStackNovaInstance {
618
@@ -12,7 +24,7 @@
1325
1426 /**
1527 * @param $apiInstanceResponse
16 - * @param bool $loadhost
 28+ * @param bool $loadhost, optional
1729 */
1830 function __construct( $apiInstanceResponse, $loadhost = false ) {
1931 $this->instance = $apiInstanceResponse;
Index: trunk/extensions/OpenStackManager/OpenStackNovaKeypair.php
@@ -1,5 +1,17 @@
22 <?php
33
 4+/**
 5+ * todo comment me
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
416 # TODO: Make this an abstract class, and make the EC2 API a subclass
517 class OpenStackNovaKeyPair {
618
Index: trunk/extensions/OpenStackManager/OpenStackNovaInstanceType.php
@@ -1,5 +1,18 @@
22 <?php
33
 4+/**
 5+ * todo comment me
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
 16+
417 # TODO: Make this an abstract class, and make the EC2 API a subclass
518 class OpenStackNovaInstanceType {
619
Index: trunk/extensions/OpenStackManager/OpenStackNovaProject.php
@@ -1,5 +1,18 @@
22 <?php
33
 4+/**
 5+ * todo comment me
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
 16+
417 class OpenStackNovaProject {
518
619 var $projectname;
@@ -7,6 +20,7 @@
821 var $projectInfo;
922 var $roles;
1023
 24+ // list of roles
1125 static $rolenames = array( 'sysadmin', 'netadmin' );
1226
1327 /**
Index: trunk/extensions/OpenStackManager/OpenStackNovaVolume.php
@@ -1,5 +1,17 @@
22 <?php
33
 4+/**
 5+ * todo comment me
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
416 # TODO: Make this an abstract class, and make the EC2 API a subclass
517 class OpenStackNovaVolume {
618
Index: trunk/extensions/OpenStackManager/OpenStackNovaDomain.php
@@ -1,11 +1,23 @@
22 <?php
33
 4+/**
 5+ * Class for Nova Domain
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
416 class OpenStackNovaDomain {
517
618 var $domainname;
719 var $domainDN;
820 var $domainInfo;
9 - var $fqdn;
 21+ var $fqdn; // fq domain name
1022
1123 /**
1224 * @param $domainname
Index: trunk/extensions/OpenStackManager/OpenStackNovaHostJob.php
@@ -1,4 +1,17 @@
22 <?php
 3+
 4+/**
 5+ * todo comment me
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
316 class OpenStackNovaHostJob extends Job {
417
518 /**
Index: trunk/extensions/OpenStackManager/OpenStackNovaHost.php
@@ -1,5 +1,17 @@
22 <?php
33
 4+/**
 5+ * todo comment me
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
416 class OpenStackNovaHost {
517
618 /**
Index: trunk/extensions/OpenStackManager/OpenStackNovaUser.php
@@ -1,5 +1,17 @@
22 <?php
33
 4+/**
 5+ * todo comment me
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
416 class OpenStackNovaUser {
517
618 var $username;
Index: trunk/extensions/OpenStackManager/OpenStackNovaImage.php
@@ -1,5 +1,17 @@
22 <?php
33
 4+/**
 5+ * todo comment me
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
416 # TODO: Make this an abstract class, and make the EC2 API a subclass
517 class OpenStackNovaImage {
618
Index: trunk/extensions/OpenStackManager/OpenStackNovaController.php
@@ -1,5 +1,17 @@
22 <?php
33
 4+/**
 5+ * todo comment me
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
416 # TODO: Make this an abstract class, and make the EC2 API a subclass
517 class OpenStackNovaController {
618
@@ -95,6 +107,7 @@
96108 }
97109
98110 /**
 111+ * @param $instanceType
99112 * @return OpenStackNovaInstanceType
100113 */
101114 function getInstanceType( $instanceType ) {
@@ -176,6 +189,7 @@
177190 }
178191
179192 /**
 193+ * @param $project
180194 * @param $groupname
181195 * @return OpenStackNovaSecurityGroup
182196 */
@@ -504,6 +518,8 @@
505519 }
506520
507521 /**
 522+ * Release ip address
 523+ *
508524 * @param $ip
509525 * @return
510526 */
@@ -514,6 +530,8 @@
515531 }
516532
517533 /**
 534+ * Attach new ip address to instance
 535+ *
518536 * @param $instanceid
519537 * @param $ip
520538 * @return null|OpenStackNovaAddress
@@ -530,6 +548,8 @@
531549 }
532550
533551 /**
 552+ * Disassociate address from an instance
 553+ *
534554 * @param $ip
535555 * @return
536556 */
Index: trunk/extensions/OpenStackManager/OpenStackNovaArticle.php
@@ -1,5 +1,17 @@
22 <?php
33
 4+/**
 5+ * todo comment me
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
416 class OpenStackNovaArticle {
517
618 public static function canCreatePages() {
Index: trunk/extensions/OpenStackManager/OpenStackNovaSecurityGroup.php
@@ -1,5 +1,17 @@
22 <?php
33
 4+/**
 5+ * todo comment me
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
416 # TODO: Make this an abstract class, and make the EC2 API a subclass
517 class OpenStackNovaSecurityGroup {
618
Index: trunk/extensions/OpenStackManager/OpenStackNovaAddress.php
@@ -1,5 +1,17 @@
22 <?php
33
 4+/**
 5+ * Class for Nova Address
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
416 # TODO: Make this an abstract class, and make the EC2 API a subclass
517 class OpenStackNovaAddress {
618
Index: trunk/extensions/OpenStackManager/OpenStackNovaPuppetGroup.php
@@ -2,7 +2,16 @@
33
44 /**
55 * Class for interacting with puppet groups, variables and classes
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
69 */
 10+
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo( "This file is a part of the OpenStackManager extension and cannot be used standalone.\n" );
 13+ die( 1 );
 14+}
 15+
716 class OpenStackNovaPuppetGroup {
817
918 private $id, $name, $position, $vars, $classes;

Follow-up revisions

RevisionCommit summaryAuthorDate
r109953Revert r108896 -- we don't check for MEDIAWIKI being defined in class-only fi...demon21:18, 24 January 2012

Comments

#Comment by Siebrand (talk | contribs)   12:46, 14 January 2012

If there is only a class file, and no globals outside of it, there is no need to check if MEDIAWIKI is defined.

#Comment by Petrb (talk | contribs)   12:56, 14 January 2012

that is true, I added it together with header comment, anyway good thing on that is that if someone "accidentaly" opened it, they get error message explaining what they opened instead of blank page which doesn't say much

#Comment by Siebrand (talk | contribs)   12:59, 14 January 2012

It's not general practice within the repo to do this. I've seen these things be removed as unneeded, too.

Status & tagging log