r78894 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78893‎ | r78894 | r78895 >
Date:17:35, 23 December 2010
Author:reedy
Status:deferred
Tags:
Comment:
Wrap some long lines of code
Modified paths:
  • /trunk/extensions/OpenStackManager/OpenStackManager.i18n.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaController.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaDomain.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaProject.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaUser.php (modified) (history)
  • /trunk/extensions/OpenStackManager/SpecialNovaDomain.php (modified) (history)
  • /trunk/extensions/OpenStackManager/SpecialNovaInstance.php (modified) (history)
  • /trunk/extensions/OpenStackManager/SpecialNovaKey.php (modified) (history)
  • /trunk/extensions/OpenStackManager/SpecialNovaProject.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenStackManager/SpecialNovaInstance.php
@@ -7,7 +7,7 @@
88 function __construct() {
99 parent::__construct( 'NovaInstance' );
1010 }
11 -
 11+
1212 function execute( $par ) {
1313 global $wgRequest, $wgUser;
1414 global $wgOpenStackManagerNovaAdminKeys;
@@ -73,7 +73,8 @@
7474
7575 $this->setHeaders();
7676 $wgOut->setPagetitle("No Nova credentials found for your account");
77 - $wgOut->addHTML('<p>There were no Nova credentials found for your user account. Please ask a Nova administrator to create credentials for you.</p>');
 77+ $wgOut->addHTML('<p>There were no Nova credentials found for your user account. '
 78+ . 'Please ask a Nova administrator to create credentials for you.</p>');
7879 }
7980
8081 function notInProject() {
@@ -89,7 +90,7 @@
9091
9192 $this->setHeaders();
9293 $wgOut->setPagetitle("Create Instance");
93 -
 94+
9495 $project = $wgRequest->getVal('project');
9596
9697 # TODO: Add project name field
@@ -211,20 +212,34 @@
212213 $projectArr["$project"] .= Html::element( 'td', array(), $instance->getInstanceState() );
213214 $projectArr["$project"] .= Html::element( 'td', array(), $instance->getInstanceType() );
214215 $projectArr["$project"] .= Html::element( 'td', array(), $instance->getImageId() );
215 - $actions = $sk->link( $this->getTitle(), 'delete', array(), array( 'action' => 'delete', 'project' => $projectname, 'instanceid' => $instance->getInstanceId() ), array() );
 216+ $actions = $sk->link( $this->getTitle(), 'delete', array(),
 217+ array( 'action' => 'delete',
 218+ 'project' => $projectname,
 219+ 'instanceid' => $instance->getInstanceId() ),
 220+ array() );
216221 $actions .= ', ';
217 - $actions .= $sk->link( $this->getTitle(), 'rename', array(), array( 'action' => 'rename', 'project' => $projectname, 'instanceid' => $instance->getInstanceId() ), array() );
 222+ $actions .= $sk->link( $this->getTitle(), 'rename', array(),
 223+ array( 'action' => 'rename',
 224+ 'project' => $projectname,
 225+ 'instanceid' => $instance->getInstanceId() ),
 226+ array() );
218227 $actions .= ', ';
219 - $actions .= $sk->link( $this->getTitle(), 'configure', array(), array( 'action' => 'configure', 'project' => $projectname, 'instanceid' => $instance->getInstanceId() ), array() );
 228+ $actions .= $sk->link( $this->getTitle(), 'configure', array(),
 229+ array( 'action' => 'configure',
 230+ 'project' => $projectname,
 231+ 'instanceid' => $instance->getInstanceId() ),
 232+ array() );
220233 $projectArr["$project"] .= Html::rawElement( 'td', array(), $actions );
221234 }
222235 foreach ( $userProjects as $projectname ) {
223236 $out .= Html::element( 'h2', array(), $projectname );
224 - $out .= $sk->link( $this->getTitle(), 'Create a new instance', array(), array( 'action' => 'create', 'project' => $projectname ), array() );
 237+ $out .= $sk->link( $this->getTitle(), 'Create a new instance', array(),
 238+ array( 'action' => 'create', 'project' => $projectname ), array() );
225239 if ( isset( $projectArr["$projectname"] ) ) {
226240 $projectOut = $header;
227241 $projectOut .= Html::rawElement( 'tr', array(), $projectArr["$projectname"] );
228 - $out .= Html::rawElement( 'table', array( 'id' => 'novainstancelist', 'class' => 'wikitable' ), $projectOut );
 242+ $out .= Html::rawElement( 'table',
 243+ array( 'id' => 'novainstancelist', 'class' => 'wikitable' ), $projectOut );
229244 }
230245 }
231246
@@ -235,9 +250,11 @@
236251 global $wgOut;
237252
238253 #$instance = $this->userNova->createInstance( $formData['instancename'], $formData['imageType'], $formData['keypair'], $formData['instanceType'], $formData['availabilityZone'] );
239 - $instance = $this->userNova->createInstance( $formData['instancename'], $formData['imageType'], '', $formData['instanceType'], $formData['availabilityZone'] );
 254+ $instance = $this->userNova->createInstance( $formData['instancename'], $formData['imageType'],
 255+ '', $formData['instanceType'], $formData['availabilityZone'] );
240256
241 - $out = Html::element( 'p', array(), 'Created instance ' . $instance->getInstanceID() . ' with image ' . $instance->getImageId() );
 257+ $out = Html::element( 'p', array(), 'Created instance ' . $instance->getInstanceID() .
 258+ ' with image ' . $instance->getImageId() );
242259 $out .= $sk->link( $this->getTitle(), 'Back to instance list', array(), array(), array() );
243260
244261 $wgOut->addHTML( $out );
Index: trunk/extensions/OpenStackManager/OpenStackNovaUser.php
@@ -86,7 +86,7 @@
8787 # roles do not
8888 $projects = array();
8989 $filter = "(&(projectManager=*)(member=$this->userDN))";
90 - $result = ldap_search( $wgAuth->ldapconn, $wgOpenStackManagerLDAPProjectBaseDN, $filter );
 90+ $result = ldap_search( $wgAuth->ldapconn, $wgOpenStackManagerLDAPProjectBaseDN, $filter );
9191 if ( $result ) {
9292 $entries = ldap_get_entries( $wgAuth->ldapconn, $result );
9393 if ( $entries ) {
@@ -114,7 +114,7 @@
115115 $this->connect();
116116
117117 $filter = "(&(cn=$project)(member=$this->userDN))";
118 - $result = ldap_search( $wgAuth->ldapconn, $wgOpenStackManagerLDAPProjectBaseDN, $filter );
 118+ $result = ldap_search( $wgAuth->ldapconn, $wgOpenStackManagerLDAPProjectBaseDN, $filter );
119119 if ( $result ) {
120120 $entries = ldap_get_entries( $wgAuth->ldapconn, $result );
121121 if ( $entries ) {
@@ -218,7 +218,7 @@
219219 $filter = "(objectclass=posixaccount)";
220220 $base = USERDN;
221221 }
222 - $result = ldap_search( $auth->ldapconn, $auth->getBaseDN( $base ), $filter );
 222+ $result = ldap_search( $auth->ldapconn, $auth->getBaseDN( $base ), $filter );
223223 if ( $result ) {
224224 $entries = ldap_get_entries( $auth->ldapconn, $result );
225225 if ( $entries ) {
Index: trunk/extensions/OpenStackManager/SpecialNovaProject.php
@@ -26,7 +26,7 @@
2727 # #}
2828 # return true;
2929 # }
30 -
 30+
3131 function execute( $par ) {
3232 global $wgRequest, $wgUser;
3333
@@ -65,7 +65,8 @@
6666
6767 $this->setHeaders();
6868 $wgOut->setPagetitle("No Nova credentials found for your account");
69 - $wgOut->addHTML('<p>There were no Nova credentials found for your user account. Please ask a Nova administrator to create credentials for you.</p>');
 69+ $wgOut->addHTML('<p>There were no Nova credentials found for your user account.' .
 70+ 'Please ask a Nova administrator to create credentials for you.</p>');
7071 }
7172
7273 function createProject() {
@@ -73,7 +74,7 @@
7475
7576 $this->setHeaders();
7677 $wgOut->setPagetitle("Create Project");
77 -
 78+
7879 $projectInfo = Array();
7980 $projectInfo['projectname'] = array(
8081 'type' => 'text',
@@ -101,7 +102,7 @@
102103
103104 $this->setHeaders();
104105 $wgOut->setPagetitle("Add projectmember");
105 -
 106+
106107 $project = $wgRequest->getText('projectname');
107108 $projectInfo = Array();
108109 $projectInfo['member'] = array(
@@ -137,7 +138,8 @@
138139 $member = $wgRequest->getText('member');
139140 $project = $wgRequest->getText('projectname');
140141 if ( ! $wgRequest->wasPosted() ) {
141 - $out .= Html::element( 'p', array(), 'Are you sure you wish to remove ' . $member . ' from project ' . $project );
 142+ $out .= Html::element( 'p', array(), 'Are you sure you wish to remove ' .
 143+ $member . ' from project ' . $project );
142144 $wgOut->addHTML( $out );
143145 }
144146 $projectInfo = Array();
@@ -171,7 +173,8 @@
172174
173175 $project = $wgRequest->getText('projectname');
174176 if ( ! $wgRequest->wasPosted() ) {
175 - $out .= Html::element( 'p', array(), 'Are you sure you wish to delete project "' . $project . '"? This action has reprecusions on all VMs. Do not take this action lightly!' );
 177+ $out .= Html::element( 'p', array(), 'Are you sure you wish to delete project "' . $project .
 178+ '"? This action has reprecusions on all VMs. Do not take this action lightly!' );
176179 $wgOut->addHTML( $out );
177180 }
178181 $projectInfo = Array();
@@ -212,15 +215,18 @@
213216 $projectMembers = $project->getMembers();
214217 $memberOut = '';
215218 foreach ( $projectMembers as $projectMember ) {
216 - $link = $sk->link( $this->getTitle(), 'remove member', array(), array( 'action' => 'deletemember', 'projectname' => $projectName, 'member' => $projectMember ), array() );
 219+ $link = $sk->link( $this->getTitle(), 'remove member', array(),
 220+ array( 'action' => 'deletemember', 'projectname' => $projectName, 'member' => $projectMember ), array() );
217221 $projectMemberOut = htmlentities( $projectMember) . ' (' . $link . ')';
218222 $memberOut .= Html::rawElement( 'li', array(), $projectMemberOut );
219223 }
220224 $memberOut .= '<br />';
221 - $memberOut .= $sk->link( $this->getTitle(), 'Add a member', array(), array( 'action' => 'addmember', 'projectname' => $projectName ), array() );
 225+ $memberOut .= $sk->link( $this->getTitle(), 'Add a member', array(),
 226+ array( 'action' => 'addmember', 'projectname' => $projectName ), array() );
222227 $membersOut = Html::rawElement( 'ul', array(), $memberOut );
223228 $projectOut .= Html::rawElement( 'td', array(), $membersOut );
224 - $link = $sk->link( $this->getTitle(), 'delete project', array(), array( 'action' => 'delete', 'projectname' => $projectName ), array() );
 229+ $link = $sk->link( $this->getTitle(), 'delete project', array(),
 230+ array( 'action' => 'delete', 'projectname' => $projectName ), array() );
225231 $projectOut .= Html::rawElement( 'td', array(), $link );
226232 $projectsOut .= Html::rawElement( 'tr', array(), $projectOut );
227233 }
@@ -269,9 +275,11 @@
270276 $project = new OpenStackNovaProject( $formData['projectname'] );
271277 $success = $project->addMember( $formData['member'] );
272278 if ( $success ) {
273 - $out = Html::element( 'p', array(), 'Successfully added ' . $formData['member'] . ' to ' . $formData['projectname'] );
 279+ $out = Html::element( 'p', array(), 'Successfully added ' . $formData['member'] .
 280+ ' to ' . $formData['projectname'] );
274281 } else {
275 - $out = Html::element( 'p', array(), 'Failed to add ' . $formData['member'] . ' to ' . $formData['projectname'] );
 282+ $out = Html::element( 'p', array(), 'Failed to add ' . $formData['member'] .
 283+ ' to ' . $formData['projectname'] );
276284 }
277285 $out .= '<br />';
278286 $sk = $wgUser->getSkin();
@@ -287,9 +295,11 @@
288296 $project = new OpenStackNovaProject( $formData['projectname'] );
289297 $success = $project->deleteMember( $formData['member'] );
290298 if ( $success ) {
291 - $out = Html::element( 'p', array(), 'Successfully removed ' . $formData['member'] . ' from ' . $formData['projectname'] );
 299+ $out = Html::element( 'p', array(), 'Successfully removed ' . $formData['member'] .
 300+ ' from ' . $formData['projectname'] );
292301 } else {
293 - $out = Html::element( 'p', array(), 'Failed to remove ' . $formData['member'] . ' from ' . $formData['projectname'] );
 302+ $out = Html::element( 'p', array(), 'Failed to remove ' . $formData['member'] .
 303+ ' from ' . $formData['projectname'] );
294304 }
295305 $out .= '<br />';
296306 $sk = $wgUser->getSkin();
Index: trunk/extensions/OpenStackManager/SpecialNovaDomain.php
@@ -39,19 +39,20 @@
4040 }
4141
4242 function notLoggedIn() {
43 - global $wgOut;
 43+ global $wgOut;
4444
45 - $this->setHeaders();
46 - $wgOut->setPagetitle("Not logged in");
47 - $wgOut->addHTML('<p>You must be logged in to perform this action</p>');
 45+ $this->setHeaders();
 46+ $wgOut->setPagetitle("Not logged in");
 47+ $wgOut->addHTML('<p>You must be logged in to perform this action</p>');
4848 }
4949
5050 function noCredentials() {
51 - global $wgOut;
 51+ global $wgOut;
5252
53 - $this->setHeaders();
54 - $wgOut->setPagetitle("No Nova credentials found for your account");
55 - $wgOut->addHTML('<p>There were no Nova credentials found for your user account. Please ask a Nova administrator to create credentials for you.</p>');
 53+ $this->setHeaders();
 54+ $wgOut->setPagetitle("No Nova credentials found for your account");
 55+ $wgOut->addHTML('<p>There were no Nova credentials found for your user account. ' .
 56+ 'Please ask a Nova administrator to create credentials for you.</p>');
5657 }
5758
5859 function createDomain() {
@@ -59,7 +60,7 @@
6061
6162 $this->setHeaders();
6263 $wgOut->setPagetitle("Create Domain");
63 -
 64+
6465 $domainInfo = Array();
6566 $domainInfo['domainname'] = array(
6667 'type' => 'text',
@@ -97,7 +98,8 @@
9899
99100 $domainname = $wgRequest->getText('domainname');
100101 if ( ! $wgRequest->wasPosted() ) {
101 - $out = Html::element( 'p', array(), 'Are you sure you wish to delete domain "' . $domainname . '"? This action has reprecusions on all VMs. Do not take this action lightly!' );
 102+ $out = Html::element( 'p', array(), 'Are you sure you wish to delete domain "' . $domainname .
 103+ '"? This action has reprecusions on all VMs. Do not take this action lightly!' );
102104 $wgOut->addHTML( $out );
103105 }
104106 $domainInfo = Array();
@@ -128,16 +130,17 @@
129131 $out = '';
130132 $sk = $wgUser->getSkin();
131133 $out .= $sk->link( $this->getTitle(), 'Create a new domain', array(), array( 'action' => 'create' ), array() );
132 - $domainsOut = Html::element( 'th', array(), 'Domain name' );
133 - $domainsOut .= Html::element( 'th', array(), 'FQDN' );
134 - $domainsOut .= Html::element( 'th', array(), 'Action' );
 134+ $domainsOut = Html::element( 'th', array(), 'Domain name' );
 135+ $domainsOut .= Html::element( 'th', array(), 'FQDN' );
 136+ $domainsOut .= Html::element( 'th', array(), 'Action' );
135137 $domains = OpenStackNovaDomain::getAllDomains();
136138 foreach ( $domains as $domain ) {
137139 $domainName = $domain->getDomainName();
138140 $fqdn = $domain->getFullyQualifiedDomainName();
139141 $domainOut = Html::element( 'td', array(), $domainName );
140142 $domainOut .= Html::element( 'td', array(), $fqdn );
141 - $link = $sk->link( $this->getTitle(), 'delete domain', array(), array( 'action' => 'delete', 'domainname' => $domainName ), array() );
 143+ $link = $sk->link( $this->getTitle(), 'delete domain', array(),
 144+ array( 'action' => 'delete', 'domainname' => $domainName ), array() );
142145 $domainOut .= Html::rawElement( 'td', array(), $link );
143146 $domainsOut .= Html::rawElement( 'tr', array(), $domainOut );
144147 }
Index: trunk/extensions/OpenStackManager/SpecialNovaKey.php
@@ -8,7 +8,7 @@
99 }
1010
1111 public function isRestricted() {
12 - return true;
 12+ return true;
1313 }
1414
1515 function execute( $par ) {
@@ -49,7 +49,8 @@
5050
5151 $this->setHeaders();
5252 $wgOut->setPagetitle("No Nova credentials found for your account");
53 - $wgOut->addHTML('<p>There were no Nova credentials found for your user account. Please ask a Nova administrator to create credentials for you.</p>');
 53+ $wgOut->addHTML('<p>There were no Nova credentials found for your user account. ' .
 54+ 'Please ask a Nova administrator to create credentials for you.</p>');
5455 }
5556
5657 function notInProject() {
@@ -76,7 +77,7 @@
7778
7879 $this->setHeaders();
7980 $wgOut->setPagetitle("Import Key");
80 -
 81+
8182 $keyInfo = Array();
8283
8384 if ( $wgOpenStackManagerNovaKeypairStorage == 'nova' ) {
@@ -231,7 +232,8 @@
232233 # of this option isn't currently recommended
233234 $keypair = $this->userNova->importKeypair( $formData['keyname'], $formData['key'] );
234235
235 - $out = Html::element( 'p', array(), 'Imported keypair ' . $keypair->getKeyName() . ' with fingerprint ' . $keypair->getKeyFingerprint() );
 236+ $out = Html::element( 'p', array(), 'Imported keypair ' . $keypair->getKeyName() .
 237+ ' with fingerprint ' . $keypair->getKeyFingerprint() );
236238 } else {
237239 $out = Html::element( 'p', array(), 'Invalid keypair location configured' );
238240 }
Index: trunk/extensions/OpenStackManager/OpenStackNovaController.php
@@ -6,13 +6,14 @@
77 var $novaConnection;
88 var $instances, $images, $keypairs, $availabilityZones;
99
10 - var $instanceTypes = array( 't1.micro', 'm1.small', 'm1.large', 'm1.xlarge', 'm2.xlarge', 'm2.2xlarge', 'm2.4xlarge', 'c1.medium', 'c1.xlarge', 'cc1.4xlarge' );
 10+ var $instanceTypes = array( 't1.micro', 'm1.small', 'm1.large', 'm1.xlarge', 'm2.xlarge', 'm2.2xlarge',
 11+ 'm2.4xlarge', 'c1.medium', 'c1.xlarge', 'cc1.4xlarge' );
1112
1213 # TODO: Make disable_ssl, hostname, and resource_prefix config options
1314 function __construct( $credentials ) {
1415 global $wgOpenStackManagerNovaDisableSSL, $wgOpenStackManagerNovaServerName,
1516 $wgOpenStackManagerNovaPort, $wgOpenStackManagerNovaResourcePrefix;
16 - wfLoadExtensionMessages('OpenStackManager');
 17+
1718 $this->novaConnection = new AmazonEC2( $credentials['accessKey'], $credentials['secretKey'] );
1819 $this->novaConnection->disable_ssl($wgOpenStackManagerNovaDisableSSL);
1920 $this->novaConnection->set_hostname($wgOpenStackManagerNovaServerName, $wgOpenStackManagerNovaPort);
Index: trunk/extensions/OpenStackManager/OpenStackManager.i18n.php
@@ -16,10 +16,10 @@
1717 */
1818 $messages['en'] = array(
1919 #for Special:Version
20 - 'openstackmanager-desc' => 'Lets users manage nova and swift',
 20+ 'openstackmanager-desc' => 'Lets users manage nova and swift',
2121
2222 #for Special:Gadgets
23 - 'openstackmanager' => 'OpenStackManager',
24 - 'openstackmanageinstance' => 'Manage Instance',
25 - 'openstackmanager-title' => 'OpenStackManager',
 23+ 'openstackmanager' => 'OpenStackManager',
 24+ 'openstackmanageinstance' => 'Manage Instance',
 25+ 'openstackmanager-title' => 'OpenStackManager',
2626 );
Index: trunk/extensions/OpenStackManager/OpenStackNovaProject.php
@@ -25,7 +25,8 @@
2626 global $wgOpenStackManagerLDAPProjectBaseDN;
2727 global $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword;
2828
29 - $result = @ldap_search( $wgAuth->ldapconn, $wgOpenStackManagerLDAPProjectBaseDN, '(&(cn=' . $this->projectname . ')(projectManager=*))' );
 29+ $result = @ldap_search( $wgAuth->ldapconn, $wgOpenStackManagerLDAPProjectBaseDN,
 30+ '(&(cn=' . $this->projectname . ')(projectManager=*))' );
3031 $this->projectInfo = @ldap_get_entries( $wgAuth->ldapconn, $result );
3132 $this->projectDN = $this->projectInfo[0]['dn'];
3233 }
Index: trunk/extensions/OpenStackManager/OpenStackNovaDomain.php
@@ -26,7 +26,8 @@
2727 global $wgOpenStackManagerLDAPDNSDomainBaseDN;
2828 global $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword;
2929
30 - $result = @ldap_search( $wgAuth->ldapconn, $wgOpenStackManagerLDAPDNSDomainBaseDN, '(dc=' . $this->domainname . ')' );
 30+ $result = @ldap_search( $wgAuth->ldapconn, $wgOpenStackManagerLDAPDNSDomainBaseDN,
 31+ '(dc=' . $this->domainname . ')' );
3132 $this->domainInfo = @ldap_get_entries( $wgAuth->ldapconn, $result );
3233 $this->fqdn = $this->domainInfo[0]['associateddomain'][0];
3334 $this->domainDN = $this->domainInfo[0]['dn'];
@@ -157,8 +158,9 @@
158159 global $wgOpenStackManagerDNSSOA;
159160
160161 $serial = date( 'YmdHis' );
161 - $soa = $wgOpenStackManagerDNSSOA['hostmaster'] . ' ' . $serial . ' ' . $wgOpenStackManagerDNSSOA['refresh'] . ' ' . $wgOpenStackManagerDNSSOA['retry'] . '
162 -' . $wgOpenStackManagerDNSSOA['expiry'] . ' ' . $wgOpenStackManagerDNSSOA['minimum'];
 162+ $soa = $wgOpenStackManagerDNSSOA['hostmaster'] . ' ' . $serial . ' ' .
 163+ $wgOpenStackManagerDNSSOA['refresh'] . ' ' . $wgOpenStackManagerDNSSOA['retry'] . ' ' .
 164+ $wgOpenStackManagerDNSSOA['expiry'] . ' ' . $wgOpenStackManagerDNSSOA['minimum'];
163165
164166 return $soa;
165167 }

Status & tagging log