jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/359434 )

Change subject: Add phpcs and make pass
......................................................................


Add phpcs and make pass

Short array syntax will be used in follow ups
to keep this patch set small
Long lines will be break in follow ups

Change-Id: I06f814d890b3bc455842aff1ddfbd302dfc40e35
---
M OpenStackManager.alias.php
M OpenStackManager.php
M OpenStackManagerHooks.php
M api/ApiNovaAddress.php
M api/ApiNovaInstance.php
M api/ApiNovaProjectLimits.php
M api/ApiNovaProjects.php
M api/ApiNovaServiceGroups.php
M composer.json
A phpcs.xml
M special/SpecialNova.php
M special/SpecialNovaAddress.php
M special/SpecialNovaDomain.php
M special/SpecialNovaKey.php
M special/SpecialNovaProject.php
M special/SpecialNovaProxy.php
M special/SpecialNovaResources.php
M special/SpecialNovaRole.php
M special/SpecialNovaServiceGroup.php
M special/SpecialNovaSudoer.php
M special/SpecialNovaVolume.php
21 files changed, 184 insertions(+), 161 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/OpenStackManager.alias.php b/OpenStackManager.alias.php
index 804b1c2..51a69e7 100644
--- a/OpenStackManager.alias.php
+++ b/OpenStackManager.alias.php
@@ -5,7 +5,6 @@
  * @file
  * @ingroup Extensions
  */
-// @codingStandardsIgnoreFile
 
 $specialPageAliases = array();
 
@@ -197,4 +196,4 @@
        'NovaKey' => array( 'Nova_密鑰' ),
        'NovaProject' => array( 'Nova_專案' ),
        'NovaResources' => array( 'Nova_資源' ),
-);
\ No newline at end of file
+);
diff --git a/OpenStackManager.php b/OpenStackManager.php
index c286623..31da9e6 100644
--- a/OpenStackManager.php
+++ b/OpenStackManager.php
@@ -13,7 +13,7 @@
  */
 
 if ( !defined( 'MEDIAWIKI' ) ) {
-       echo( "This file is an extension to the MediaWiki software and cannot 
be used standalone.\n" );
+       echo "This file is an extension to the MediaWiki software and cannot be 
used standalone.\n";
        die( 1 );
 }
 
@@ -91,7 +91,7 @@
 
 // Username for special observer user -- hidden
 //  from the OSM front end.
-$wgOpenStackHiddenUsernames = array('novaobserver');
+$wgOpenStackHiddenUsernames = array( 'novaobserver' );
 
 // Key/value pairs like array( 'region1' => '10.4.0.11', 'region2' => 
'10.68.1.35' )
 $wgOpenStackManagerProxyGateways = array();
@@ -306,7 +306,7 @@
  * @return bool
  */
 function efOpenStackSchemaUpdates( $updater ) {
-       $base = dirname( __FILE__ );
+       $base = __DIR__;
        switch ( $updater->getDB()->getType() ) {
        case 'mysql':
                $updater->addExtensionTable( 'openstack_tokens', 
"$base/schema-changes/tokens.sql" );
@@ -371,7 +371,7 @@
  * @param &$users array to append implicitly subscribed users to.
  * @return bool true in all cases
  */
-function efOpenStackGetDefaultNotifiedUsers ( $event, &$users ) {
+function efOpenStackGetDefaultNotifiedUsers( $event, &$users ) {
        if ( $event->getType() == 'osm-instance-build-completed' ||
                $event->getType() == 'osm-instance-deleted'
        ) {
diff --git a/OpenStackManagerHooks.php b/OpenStackManagerHooks.php
index 9a31ec1..98377fb 100644
--- a/OpenStackManagerHooks.php
+++ b/OpenStackManagerHooks.php
@@ -24,7 +24,7 @@
                                $result = array( 
'openstackmanager-nonovacred-admincreate' );
                        }
                        $project = strtolower( $title->getRootText() );
-                       if ( !$userLDAP->inRole( 'projectadmin', $project ) && 
!$user->isAllowed( 'editallhiera' )  ) {
+                       if ( !$userLDAP->inRole( 'projectadmin', $project ) && 
!$user->isAllowed( 'editallhiera' ) ) {
                                $result = array( 
'openstackmanager-hiera-noadmin', $project );
                                return false;
                        }
diff --git a/api/ApiNovaAddress.php b/api/ApiNovaAddress.php
index e4e80b9..f8d8cc2 100644
--- a/api/ApiNovaAddress.php
+++ b/api/ApiNovaAddress.php
@@ -5,7 +5,7 @@
        public $params;
 
        public function canExecute() {
-               if ( ! $this->userLDAP->exists() ) {
+               if ( !$this->userLDAP->exists() ) {
                        if ( is_callable( array( $this, 'dieWithError' ) ) ) {
                                $this->dieWithError( 
'openstackmanager-nonovacred' );
                        } else {
@@ -13,10 +13,10 @@
                        }
                }
 
-               $projects = split( ',', $this->params['project'] );
+               $projects = explode( ',', $this->params['project'] );
 
                foreach ( $projects as $p ) {
-                       if ( ! $this->userLDAP->inProject( $p ) ) {
+                       if ( !$this->userLDAP->inProject( $p ) ) {
                                if ( is_callable( array( $this, 'dieWithError' 
) ) ) {
                                        $this->dieWithError( array( 
'openstackmanager-noaccount', wfEscapeWikiText( $p ) ) );
                                } else {
@@ -24,7 +24,7 @@
                                }
                        }
 
-                       if ( ! $this->userLDAP->inRole( 'projectadmin', $p ) ) {
+                       if ( !$this->userLDAP->inRole( 'projectadmin', $p ) ) {
                                if ( is_callable( array( $this, 'dieWithError' 
) ) ) {
                                        $this->dieWithError( [
                                                'openstackmanager-needrole',
@@ -61,14 +61,14 @@
 
                $subaction = $this->params['subaction'];
 
-               switch( $subaction ) {
+               switch ( $subaction ) {
                        case 'disassociate':
                                $success = $this->userNova->disassociateAddress(
                                        $instanceId,
                                        $ipAddr
                                );
 
-                               if ( ! $success ) {
+                               if ( !$success ) {
                                        if ( is_callable( array( $this, 
'dieWithError' ) ) ) {
                                                $this->dieWithError( array( 
'openstackmanager-disassociateaddressfailed', wfEscapeWikiText( $ipAddr ) ) );
                                        } else {
@@ -76,7 +76,7 @@
                                        }
                                }
 
-                               $result->addValue( null, 
$this->getModuleName(), array ( 'addressstate' => 'free' ) );
+                               $result->addValue( null, 
$this->getModuleName(), array( 'addressstate' => 'free' ) );
                                break;
                }
        }
diff --git a/api/ApiNovaInstance.php b/api/ApiNovaInstance.php
index 1dfea40..f52fe6c 100644
--- a/api/ApiNovaInstance.php
+++ b/api/ApiNovaInstance.php
@@ -5,21 +5,21 @@
        public $params;
 
        public function canExecute() {
-               if ( ! $this->userLDAP->exists() ) {
+               if ( !$this->userLDAP->exists() ) {
                        if ( is_callable( array( $this, 'dieWithError' ) ) ) {
                                $this->dieWithError( 
'openstackmanager-nonovacred' );
                        } else {
                                $this->dieUsage( 'No credentials found for your 
account.', 'openstackmanager-nonovacred' );
                        }
                }
-               if ( ! $this->userLDAP->inProject( $this->params['project'] ) ) 
{
+               if ( !$this->userLDAP->inProject( $this->params['project'] ) ) {
                        if ( is_callable( array( $this, 'dieWithError' ) ) ) {
                                $this->dieWithError( array( 
'openstackmanager-noaccount', wfEscapeWikiText( $this->params['project'] ) ) );
                        } else {
                                $this->dieUsage( 'User account is not in the 
project specified.', 'openstackmanager-noaccount' );
                        }
                }
-               if ( ! $this->userLDAP->inRole( 'projectadmin', 
$this->params['project'] ) ) {
+               if ( !$this->userLDAP->inRole( 'projectadmin', 
$this->params['project'] ) ) {
                        if ( is_callable( array( $this, 'dieWithError' ) ) ) {
                                $this->dieWithError( [
                                        'openstackmanager-needrole',
@@ -41,7 +41,7 @@
                $this->userNova->setProject( $this->params['project'] );
                $this->userNova->setRegion( $this->params['region'] );
 
-               switch( $this->params['subaction'] ) {
+               switch ( $this->params['subaction'] ) {
                case 'reboot':
                        $success = $this->userNova->rebootInstance( 
$this->params['instanceid'] );
                        if ( !$success ) {
@@ -53,12 +53,12 @@
                        }
                        $instance = $this->userNova->getInstance( 
$this->params['instanceid'] );
                        if ( $instance ) {
-                               $this->getResult()->addValue( null, 
$this->getModuleName(), array ( 'instancestate' => 
$instance->getInstanceState() ) );
+                               $this->getResult()->addValue( null, 
$this->getModuleName(), array( 'instancestate' => $instance->getInstanceState() 
) );
                        }
                        break;
                case 'consoleoutput':
                        $output = $this->userNova->getConsoleOutput( 
$this->params['instanceid'] );
-                       $this->getResult()->addValue( null, 
$this->getModuleName(), array ( 'consoleoutput' => $output ) );
+                       $this->getResult()->addValue( null, 
$this->getModuleName(), array( 'consoleoutput' => $output ) );
                        break;
                case 'delete':
                        $instanceOSID = $this->params['instanceid'];
@@ -90,7 +90,7 @@
        // Face parameter.
        public function getAllowedParams() {
                return array(
-                       'subaction' => array (
+                       'subaction' => array(
                                ApiBase::PARAM_TYPE => array(
                                        'reboot',
                                        'consoleoutput',
@@ -98,15 +98,15 @@
                                ),
                                ApiBase::PARAM_REQUIRED => true
                        ),
-                       'instanceid' => array (
+                       'instanceid' => array(
                                ApiBase::PARAM_TYPE => 'string',
                                ApiBase::PARAM_REQUIRED => true
                        ),
-                       'project' => array (
+                       'project' => array(
                                ApiBase::PARAM_TYPE => 'string',
                                ApiBase::PARAM_REQUIRED => true
                        ),
-                       'region' => array (
+                       'region' => array(
                                ApiBase::PARAM_TYPE => 'string',
                                ApiBase::PARAM_REQUIRED => true
                        ),
@@ -116,7 +116,7 @@
                        ),
                );
        }
- 
+
        /**
         * @deprecated since MediaWiki core 1.25
         */
diff --git a/api/ApiNovaProjectLimits.php b/api/ApiNovaProjectLimits.php
index 95584cd..203a434 100644
--- a/api/ApiNovaProjectLimits.php
+++ b/api/ApiNovaProjectLimits.php
@@ -4,8 +4,8 @@
        public $userNova;
        public $params;
 
-       public function canExecute( $rights=array() ) {
-               if ( ! $this->userLDAP->exists() ) {
+       public function canExecute( $rights = array() ) {
+               if ( !$this->userLDAP->exists() ) {
                        if ( is_callable( array( $this, 'dieWithError' ) ) ) {
                                $this->dieWithError( 
'openstackmanager-nonovacred' );
                        } else {
@@ -13,7 +13,7 @@
                        }
                }
                if ( in_array( 'inproject', $rights ) || in_array( 
'isprojectadmin', $rights ) ) {
-                       if ( ! $this->userLDAP->inProject( 
$this->params['project'] ) ) {
+                       if ( !$this->userLDAP->inProject( 
$this->params['project'] ) ) {
                                if ( is_callable( array( $this, 'dieWithError' 
) ) ) {
                                        $this->dieWithError( array( 
'openstackmanager-noaccount', wfEscapeWikiText( $this->params['project'] ) ) );
                                } else {
@@ -22,7 +22,7 @@
                        }
                }
                if ( in_array( 'isprojectadmin', $rights ) ) {
-                       if ( ! $this->userLDAP->inRole( 'projectadmin', 
$this->params['project'] ) ) {
+                       if ( !$this->userLDAP->inRole( 'projectadmin', 
$this->params['project'] ) ) {
                                if ( is_callable( array( $this, 'dieWithError' 
) ) ) {
                                        $this->dieWithError( [
                                                'openstackmanager-needrole',
@@ -40,7 +40,7 @@
                $this->params = $this->extractRequestParams();
                $this->userLDAP = new OpenStackNovaUser();
 
-               switch( $this->params['subaction'] ) {
+               switch ( $this->params['subaction'] ) {
                case 'getlimits':
                        $this->canExecute( array( 'isprojectadmin' ) );
                        $this->userNova = OpenStackNovaController::newFromUser( 
$this->userLDAP );
@@ -75,17 +75,17 @@
        // Face parameter.
        public function getAllowedParams() {
                return array(
-                       'subaction' => array (
+                       'subaction' => array(
                                ApiBase::PARAM_TYPE => array(
                                        'getlimits',
                                ),
                                ApiBase::PARAM_REQUIRED => true
                        ),
-                       'project' => array (
+                       'project' => array(
                                ApiBase::PARAM_TYPE => 'string',
                                ApiBase::PARAM_REQUIRED => true
                        ),
-                       'region' => array (
+                       'region' => array(
                                ApiBase::PARAM_TYPE => 'string',
                                ApiBase::PARAM_REQUIRED => false
                        ),
diff --git a/api/ApiNovaProjects.php b/api/ApiNovaProjects.php
index 92146ee..11f5b57 100644
--- a/api/ApiNovaProjects.php
+++ b/api/ApiNovaProjects.php
@@ -7,7 +7,7 @@
                $this->params = $this->extractRequestParams();
                $this->userLDAP = new OpenStackNovaUser();
 
-               switch( $this->params['subaction'] ) {
+               switch ( $this->params['subaction'] ) {
                case 'getall':
                        if ( isset( $this->params['project'] ) ) {
                                $projects = array( 
OpenStackNovaProject::getProjectByName( $this->params['project'] ) );
@@ -67,18 +67,18 @@
        // Face parameter.
        public function getAllowedParams() {
                return array(
-                       'subaction' => array (
+                       'subaction' => array(
                                ApiBase::PARAM_TYPE => array(
                                        'getall',
                                        'getuser',
                                ),
                                ApiBase::PARAM_REQUIRED => true
                        ),
-                       'project' => array (
+                       'project' => array(
                                ApiBase::PARAM_TYPE => 'string',
                                ApiBase::PARAM_REQUIRED => false
                        ),
-                       'username' => array (
+                       'username' => array(
                                ApiBase::PARAM_TYPE => 'string',
                                ApiBase::PARAM_REQUIRED => false
                        ),
diff --git a/api/ApiNovaServiceGroups.php b/api/ApiNovaServiceGroups.php
index d155af1..f7e76e6 100644
--- a/api/ApiNovaServiceGroups.php
+++ b/api/ApiNovaServiceGroups.php
@@ -6,7 +6,7 @@
        function execute() {
                $this->params = $this->extractRequestParams();
 
-               switch( $this->params['subaction'] ) {
+               switch ( $this->params['subaction'] ) {
                case 'getservicegroups':
                        $project = OpenStackNovaProject::getProjectByName( 
$this->params['project'] );
                        $project->fetchServiceGroups();
@@ -30,17 +30,17 @@
        // Face parameter.
        public function getAllowedParams() {
                return array(
-                       'subaction' => array (
+                       'subaction' => array(
                                ApiBase::PARAM_TYPE => array(
                                        'getservicegroups',
                                ),
                                ApiBase::PARAM_REQUIRED => true
                        ),
-                       'project' => array (
+                       'project' => array(
                                ApiBase::PARAM_TYPE => 'string',
                                ApiBase::PARAM_REQUIRED => true
                        ),
-                       'shellmembers' => array (
+                       'shellmembers' => array(
                                ApiBase::PARAM_TYPE => 'boolean',
                                ApiBase::PARAM_REQUIRED => false
                        ),
diff --git a/composer.json b/composer.json
index 3b445f0..a1adda4 100644
--- a/composer.json
+++ b/composer.json
@@ -4,11 +4,14 @@
        },
        "require-dev": {
                "jakub-onderka/php-parallel-lint": "0.9.2",
-               "jakub-onderka/php-console-highlighter": "0.3.2"
+               "jakub-onderka/php-console-highlighter": "0.3.2",
+               "mediawiki/mediawiki-codesniffer": "0.7.2"
        },
        "scripts": {
+               "fix": "phpcbf",
                "test": [
-                       "parallel-lint . --exclude vendor"
+                       "parallel-lint . --exclude vendor --exclude 
node_modules",
+                       "phpcs -p -s"
                ]
        }
 }
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 0000000..425a584
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ruleset>
+       <rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
+               <exclude name="PSR2.Methods.MethodDeclaration.Underscore"/>
+               <exclude name="Generic.Arrays.DisallowLongArraySyntax"/>
+               <exclude name="Generic.Files.LineLength"/>
+       </rule>
+       <file>.</file>
+       <arg name="extensions" value="php,php5,inc"/>
+       <arg name="encoding" value="UTF-8"/>
+       <exclude-pattern>vendor</exclude-pattern>
+       <exclude-pattern>node_modules</exclude-pattern>
+</ruleset>
diff --git a/special/SpecialNova.php b/special/SpecialNova.php
index ad01382..bd3f4de 100644
--- a/special/SpecialNova.php
+++ b/special/SpecialNova.php
@@ -75,7 +75,7 @@
         * @return bool|string
         */
        function validateText( $resourcename, $alldata ) {
-               if ( ! preg_match( "/^[a-z][a-z0-9-]*$/", $resourcename ) ) {
+               if ( !preg_match( "/^[a-z][a-z0-9-]*$/", $resourcename ) ) {
                        return Xml::element(
                                'span',
                                array( 'class' => 'error' ),
@@ -92,7 +92,7 @@
         * @return bool|string
         */
        function validateDomain( $resourcename, $alldata ) {
-               if ( ! preg_match( "/^[a-z\*][a-z0-9\-]*$/", $resourcename ) ) {
+               if ( !preg_match( "/^[a-z\*][a-z0-9\-]*$/", $resourcename ) ) {
                        return Xml::element(
                                'span',
                                array( 'class' => 'error' ),
@@ -162,7 +162,7 @@
                return Linker::link( $title, $resource );
        }
 
-       function createActionLink( $msg, $params, $title = null, 
$attribs=array() ) {
+       function createActionLink( $msg, $params, $title = null, $attribs = 
array() ) {
                if ( !$title ) {
                        $title = $this->getPageTitle();
                }
@@ -181,7 +181,7 @@
                return Html::rawElement( 'ul', array(), $resourceList );
        }
 
-       public static function pushResourceColumn( &$row, $value, 
$attribs=array() ) {
+       public static function pushResourceColumn( &$row, $value, $attribs = 
array() ) {
                if ( array_key_exists( 'class', $attribs ) ) {
                        $attribs['class'] = $attribs['class'] . ' Nova_cell';
                } else {
@@ -190,7 +190,7 @@
                $row[] = Html::element( 'td', $attribs, $value );
        }
 
-       public static function pushRawResourceColumn( &$row, $value, 
$attribs=array() ) {
+       public static function pushRawResourceColumn( &$row, $value, $attribs = 
array() ) {
                if ( array_key_exists( 'class', $attribs ) ) {
                        $attribs['class'] = $attribs['class'] . ' Nova_cell';
                } else {
diff --git a/special/SpecialNovaAddress.php b/special/SpecialNovaAddress.php
index 02bc908..7c6dfed 100644
--- a/special/SpecialNovaAddress.php
+++ b/special/SpecialNovaAddress.php
@@ -63,7 +63,7 @@
 
                $project = $this->getRequest()->getText( 'project' );
                $region = $this->getRequest()->getText( 'region' );
-               if ( ! $this->userLDAP->inRole( 'projectadmin', $project ) ) {
+               if ( !$this->userLDAP->inRole( 'projectadmin', $project ) ) {
                        $this->notInRole( 'projectadmin', $project );
                        return false;
                }
@@ -108,12 +108,12 @@
 
                $project = $this->getRequest()->getText( 'project' );
                $region = $this->getRequest()->getText( 'region' );
-               if ( ! $this->userLDAP->inRole( 'projectadmin', $project ) ) {
+               if ( !$this->userLDAP->inRole( 'projectadmin', $project ) ) {
                        $this->notInRole( 'projectadmin', $project );
                        return false;
                }
                $id = $this->getRequest()->getText( 'id' );
-               if ( ! $this->getRequest()->wasPosted() ) {
+               if ( !$this->getRequest()->wasPosted() ) {
                        $address = $this->userNova->getAddress( $id );
                        $ip = $address->getPublicIP();
                        $this->getOutput()->addWikiMsg( 
'openstackmanager-releaseaddress-confirm', $ip );
@@ -163,7 +163,7 @@
                $id = $this->getRequest()->getText( 'id' );
                $project = $this->getRequest()->getText( 'project' );
                $region = $this->getRequest()->getText( 'region' );
-               if ( ! $this->userLDAP->inRole( 'projectadmin', $project ) ) {
+               if ( !$this->userLDAP->inRole( 'projectadmin', $project ) ) {
                        $this->notInRole( 'projectadmin', $project );
                        return false;
                }
@@ -227,12 +227,12 @@
 
                $project = $this->getRequest()->getText( 'project' );
                $region = $this->getRequest()->getText( 'region' );
-               if ( ! $this->userLDAP->inRole( 'projectadmin', $project ) ) {
+               if ( !$this->userLDAP->inRole( 'projectadmin', $project ) ) {
                        $this->notInRole( 'projectadmin', $project );
                        return false;
                }
                $id = $this->getRequest()->getText( 'id' );
-               if ( ! $this->getRequest()->wasPosted() ) {
+               if ( !$this->getRequest()->wasPosted() ) {
                        $address = $this->userNova->getAddress( $id );
                        $ip = $address->getPublicIP();
                        $this->getOutput()->addWikiMsg( 
'openstackmanager-disassociateaddress-confirm', $ip );
@@ -280,7 +280,7 @@
 
                $project = $this->getRequest()->getText( 'project' );
                $region = $this->getRequest()->getText( 'region' );
-               if ( ! $this->userLDAP->inRole( 'projectadmin', $project ) ) {
+               if ( !$this->userLDAP->inRole( 'projectadmin', $project ) ) {
                        $this->notInRole( 'projectadmin', $project );
                        return false;
                }
@@ -347,14 +347,14 @@
 
                $project = $this->getRequest()->getText( 'project' );
                $region = $this->getRequest()->getText( 'region' );
-               if ( ! $this->userLDAP->inRole( 'projectadmin', $project ) ) {
+               if ( !$this->userLDAP->inRole( 'projectadmin', $project ) ) {
                        $this->notInRole( 'projectadmin', $project );
                        return false;
                }
                $id = $this->getRequest()->getText( 'id' );
                $fqdn = $this->getRequest()->getText( 'fqdn' );
                $hostname = $this->getRequest()->getText( 'hostname' );
-               if ( ! $this->getRequest()->wasPosted() ) {
+               if ( !$this->getRequest()->wasPosted() ) {
                        $address = $this->userNova->getAddress( $id );
                        $ip = $address->getPublicIP();
                        $this->getOutput()->addWikiMsg( 
'openstackmanager-removehost-confirm', $fqdn, $ip );
@@ -587,7 +587,7 @@
         */
        function tryAllocateSubmit( $formData, $entryPoint = 'internal' ) {
                $address = $this->userNova->allocateAddress();
-               if ( ! $address ) {
+               if ( !$address ) {
                        $this->getOutput()->addWikiMsg( 
'openstackmanager-allocateaddressfailed' );
                        return true;
                }
@@ -610,7 +610,7 @@
         */
        function tryReleaseSubmit( $formData, $entryPoint = 'internal' ) {
                $id = $formData['id'];
-               #TODO: Instead of throwing an error when host exist or the IP
+               # TODO: Instead of throwing an error when host exist or the IP
                # is associated, remove all host entries and disassociate the IP
                # then release the address
                $outputPage = $this->getOutput();
@@ -717,7 +717,7 @@
                $address = $this->userNova->getAddress( $id );
                $ip = $address->getPublicIp();
                $outputPage = $this->getOutput();
-               if ( ! $address ) {
+               if ( !$address ) {
                        $outputPage->addWikiMsg( 
'openstackmanager-invalidaddress', $ip );
                        return true;
                }
@@ -763,7 +763,7 @@
                $id = $formData['id'];
                $address = $this->userNova->getAddress( $id );
                $outputPage = $this->getOutput();
-               if ( ! $address ) {
+               if ( !$address ) {
                        $outputPage->addWikiMsg( 
'openstackmanager-invalidaddress', $id );
                        return true;
                }
diff --git a/special/SpecialNovaDomain.php b/special/SpecialNovaDomain.php
index b8a6412..109f6ab 100644
--- a/special/SpecialNovaDomain.php
+++ b/special/SpecialNovaDomain.php
@@ -46,7 +46,7 @@
                $this->getOutput()->setPageTitle( $this->msg( 
'openstackmanager-deletedomain' ) );
 
                $domainname = $this->getRequest()->getText( 'domainname' );
-               if ( ! $this->getRequest()->wasPosted() ) {
+               if ( !$this->getRequest()->wasPosted() ) {
                        $this->getOutput()->addWikiMsg( 
'openstackmanager-deletedomain-confirm', $domainname );
                }
                $domainInfo = array();
@@ -146,7 +146,7 @@
         */
        function tryCreateSubmit( $formData, $entryPoint = 'internal' ) {
                $success = OpenStackNovaDomain::createDomain( 
$formData['domainname'], $formData['fqdn'], $formData['location'] );
-               if ( ! $success ) {
+               if ( !$success ) {
                        $this->getOutput()->addWikiMsg( 
'openstackmanager-createdomainfailed' );
                        return false;
                }
diff --git a/special/SpecialNovaKey.php b/special/SpecialNovaKey.php
index d115f4a..43a5f26 100644
--- a/special/SpecialNovaKey.php
+++ b/special/SpecialNovaKey.php
@@ -53,7 +53,7 @@
                if ( $wgOpenStackManagerNovaKeypairStorage === 'nova' ) {
                        $keyname = $this->getRequest()->getVal( 'keyname' );
                        $project = $this->getRequest()->getVal( 'project' );
-                       if ( $project && ! $this->userLDAP->inProject( $project 
) ) {
+                       if ( $project && !$this->userLDAP->inProject( $project 
) ) {
                                $this->notInProject( $project );
                                return true;
                        }
@@ -70,7 +70,7 @@
                } elseif ( $wgOpenStackManagerNovaKeypairStorage === 'ldap' ) {
                        $hash = $this->getRequest()->getVal( 'hash' );
                        $keypairs = $this->userLDAP->getKeypairs();
-                       if ( ! $this->getRequest()->wasPosted() ) {
+                       if ( !$this->getRequest()->wasPosted() ) {
                                $this->getOutput()->addHTML( Html::element( 
'pre', array(), $keypairs[$hash] ) );
                                $this->getOutput()->addWikiMsg( 
'openstackmanager-deletekeyconfirm' );
                        }
@@ -190,20 +190,22 @@
 
                // We need to store the key in a file, as puttygen opens it 
several times.
                $tmpfile = tmpfile();
-               if (!$tmpfile)
+               if ( !$tmpfile ) {
                        return false;
+               }
 
                fwrite( $tmpfile, $keydata );
 
                $descriptorspec = array(
-                  0 => $tmpfile,
-                  1 => array("pipe", "w"),
-                  2 => array("file", wfGetNull(), "a")
+                       0 => $tmpfile,
+                       1 => array( "pipe", "w" ),
+                       2 => array( "file", wfGetNull(), "a" )
                );
 
                $process = proc_open( escapeshellcmd( $wgPuttygen ) . ' -O 
public-openssh -o /dev/stdout /dev/stdin', $descriptorspec, $pipes );
-               if ( $process === false )
+               if ( $process === false ) {
                        return false;
+               }
 
                $data = stream_get_contents( $pipes[1] );
                fclose( $pipes[1] );
@@ -224,12 +226,13 @@
                fwrite( $tmpfile, str_repeat( "\0", strlen( $keydata ) + 4096 - 
strlen( $keydata ) % 4096 ) );
                fclose( $tmpfile );
 
-               if ( $data === false || !preg_match( '/(^| )ssh-(rsa|dss) /', 
$data ) )
+               if ( $data === false || !preg_match( '/(^| )ssh-(rsa|dss) /', 
$data ) ) {
                        return false;
+               }
 
                return $data;
        }
-        /**
+       /**
         * Converts a public ssh key to openssh format, using ssh-keygen.
         * @param $keydata string SSH public/private key in some format
         * @return mixed Public key in openssh format or false
@@ -237,8 +240,9 @@
        static function opensshFormatKeySshKeygen( $keydata ) {
                global $wgSshKeygen;
 
-               if ( wfIsWindows() || !$wgSshKeygen )
+               if ( wfIsWindows() || !$wgSshKeygen ) {
                        return false;
+               }
 
                if ( substr_compare( $keydata, 'PuTTY-User-Key-File-2:', 0, 22 
) == 0 ) {
                        $keydata = explode( "\nPrivate-Lines:", $keydata, 2 );
@@ -246,14 +250,15 @@
                }
 
                $descriptorspec = array(
-                  0 => array("pipe", "r"),
-                  1 => array("pipe", "w"),
-                  2 => array("file", wfGetNull(), "a")
+                       0 => array( "pipe", "r" ),
+                       1 => array( "pipe", "w" ),
+                       2 => array( "file", wfGetNull(), "a" )
                );
 
                $process = proc_open( escapeshellcmd( $wgSshKeygen ) . ' -i -f 
/dev/stdin', $descriptorspec, $pipes );
-               if ( $process === false )
+               if ( $process === false ) {
                        return false;
+               }
 
                fwrite( $pipes[0], $keydata );
                fclose( $pipes[0] );
@@ -262,8 +267,9 @@
                fclose( $pipes[1] );
                proc_close( $process );
 
-               if ( $data === false || !preg_match( '/(^| )ssh-(rsa|dss) /', 
$data ) )
+               if ( $data === false || !preg_match( '/(^| )ssh-(rsa|dss) /', 
$data ) ) {
                        return false;
+               }
 
                return $data;
        }
diff --git a/special/SpecialNovaProject.php b/special/SpecialNovaProject.php
index f741dd4..b6ec0bd 100644
--- a/special/SpecialNovaProject.php
+++ b/special/SpecialNovaProject.php
@@ -28,7 +28,7 @@
                        return;
                }
                $this->userLDAP = new OpenStackNovaUser();
-               if ( ! $this->userLDAP->exists() ) {
+               if ( !$this->userLDAP->exists() ) {
                        $this->noCredentials();
                        return;
                }
@@ -154,7 +154,7 @@
                $this->getOutput()->setPageTitle( $this->msg( 
'openstackmanager-deleteproject' ) );
 
                $project = $this->getRequest()->getText( 'projectid' );
-               if ( ! $this->getRequest()->wasPosted() ) {
+               if ( !$this->getRequest()->wasPosted() ) {
                        $this->getOutput()->addWikiMsg( 
'openstackmanager-removeprojectconfirm', $project );
                }
                $projectInfo = array();
@@ -346,7 +346,7 @@
                global $wgOpenStackManagerLDAPUsername;
 
                $project = OpenStackNovaProject::createProject( 
$formData['projectname'] );
-               if ( ! $project ) {
+               if ( !$project ) {
                        $this->getOutput()->addWikiMsg( 
'openstackmanager-createprojectfailed' );
                        return false;
                }
@@ -503,7 +503,7 @@
        function tryDeleteMemberSubmit( $formData, $entryPoint = 'internal' ) {
                $project = OpenStackNovaProject::getProjectById( 
$formData['projectid'] );
                $projectName = $project->getName();
-               if ( ! $project ) {
+               if ( !$project ) {
                        $this->getOutput()->addWikiMsg( 
'openstackmanager-nonexistentproject' );
                        return true;
                }
diff --git a/special/SpecialNovaProxy.php b/special/SpecialNovaProxy.php
index 0bbc6da..8e946cd 100644
--- a/special/SpecialNovaProxy.php
+++ b/special/SpecialNovaProxy.php
@@ -37,13 +37,13 @@
                $this->userNova->setRegion( $region );
 
                if ( $action === "create" ) {
-                       if ( ! $this->userLDAP->inProject( $this->projectName ) 
) {
+                       if ( !$this->userLDAP->inProject( $this->projectName ) 
) {
                                $this->notInProject( $this->projectName );
                                return;
                        }
                        $this->createProxy();
                } elseif ( $action === "delete" ) {
-                       if ( ! $this->userLDAP->inProject( $this->projectName ) 
) {
+                       if ( !$this->userLDAP->inProject( $this->projectName ) 
) {
                                $this->notInProject( $this->project );
                                return;
                        }
@@ -59,7 +59,7 @@
        function createProxy() {
                $this->setHeaders();
                $this->getOutput()->setPageTitle( $this->msg( 
'openstackmanager-createproxy' ) );
-               if ( ! $this->userLDAP->inRole( 'projectadmin', 
$this->projectName ) ) {
+               if ( !$this->userLDAP->inRole( 'projectadmin', 
$this->projectName ) ) {
                        $this->notInRole( 'projectadmin', $this->projectName );
                        return false;
                }
@@ -150,13 +150,13 @@
        function deleteProxy() {
                $this->setHeaders();
                $this->getOutput()->setPageTitle( $this->msg( 
'openstackmanager-deleteproxy' ) );
-               if ( ! $this->userLDAP->inRole( 'projectadmin', 
$this->projectName ) ) {
+               if ( !$this->userLDAP->inRole( 'projectadmin', 
$this->projectName ) ) {
                        $this->notInRole( 'projectadmin', $this->projectName );
                        return false;
                }
                $proxyfqdn = $this->getRequest()->getText( 'proxyfqdn' );
                $region = $this->getRequest()->getText( 'region' );
-               if ( ! $this->getRequest()->wasPosted() ) {
+               if ( !$this->getRequest()->wasPosted() ) {
                        $this->getOutput()->addWikiMsg( 
'openstackmanager-deleteproxy-confirm', $proxyfqdn );
                }
                $proxyInfo = array();
@@ -250,11 +250,10 @@
                                $this->pushResourceColumn( $proxyRow, $fqdn );
                                $this->pushResourceColumn( $proxyRow, 
$proxy->getBackend() );
 
-                   $actions = array();
-                   $actions[] = $this->createActionLink( 
'openstackmanager-delete',
-                                                                       array( 
'action' => 'delete', 'proxyfqdn' => $fqdn, 'project' => $projectName, 'region' 
=> $region ) );
-                   $this->pushRawResourceColumn( $proxyRow, 
$this->createResourceList( $actions ) );
-
+                               $actions = array();
+                               $actions[] = $this->createActionLink( 
'openstackmanager-delete',
+                                       array( 'action' => 'delete', 
'proxyfqdn' => $fqdn, 'project' => $projectName, 'region' => $region ) );
+                               $this->pushRawResourceColumn( $proxyRow, 
$this->createResourceList( $actions ) );
 
                                $proxyRows[] = $proxyRow;
                        }
@@ -269,7 +268,7 @@
                return $out;
        }
 
-       function addHost($hostName, $domain, $ip) {
+       function addHost( $hostName, $domain, $ip ) {
                $domain = OpenStackNovaDomain::getDomainByName( $domain );
                $hostbyip = OpenStackNovaHost::getHostByPublicIP( $ip );
                $fqdn = $hostName . '.' . 
$domain->getFullyQualifiedDomainName();
@@ -277,13 +276,13 @@
                if ( $hostbyip ) {
                        # We need to add an associateddomain, if the 
associateddomain doesn't already exist
                        $success = $hostbyip->addAssociatedDomain( $fqdn );
-                       if ( ! $success ) {
+                       if ( !$success ) {
                                return false;
                        }
                } else {
                        # This is a new host entry
                        $host = OpenStackNovaHost::addPublicHost( $hostName, 
$ip, $domain );
-                       if ( ! $host ) {
+                       if ( !$host ) {
                                return false;
                        }
                }
@@ -291,11 +290,11 @@
                return true;
        }
 
-       function deleteHost($fqdn, $ip) {
+       function deleteHost( $fqdn, $ip ) {
                $host = OpenStackNovaHost::getHostByPublicIP( $ip );
-        if ( $host ) {
+               if ( $host ) {
                        $records = $host->getAssociatedDomains();
-                               if ( count( $records ) > 1 ) {
+                       if ( count( $records ) > 1 ) {
                                # We need to keep the host, but remove the fqdn
                                $success = $host->deleteAssociatedDomain( $fqdn 
);
                                if ( $success ) {
@@ -338,7 +337,7 @@
                $success =  $this->userNova->deleteProxy( $fqdn );
                if ( $success ) {
                        $success = $this->deleteHost( $fqdn, 
$wgOpenStackManagerProxyGateways[$region] );
-                       if ( ! $success ) {
+                       if ( !$success ) {
                                $outputPage->addWikiMsg( 
'openstackmanager-removehostfailed', $fqdn );
                        }
                } else {
@@ -352,7 +351,6 @@
 
                return true;
        }
-
 
        /**
         * @param  $formData
@@ -376,7 +374,7 @@
                $outputPage = $this->getOutput();
                $gatewayIP = $wgOpenStackManagerProxyGateways[$region];
 
-               if ( ! ( array_key_exists( $region, 
$wgOpenStackManagerProxyGateways ) ) ) {
+               if ( !( array_key_exists( $region, 
$wgOpenStackManagerProxyGateways ) ) ) {
                        $outputPage->addWikiMsg( 
'openstackmanager-addhostfailed', $proxyName, $gatewayIP );
                        $outputPage->addHTML( $goback );
                        return true;
diff --git a/special/SpecialNovaResources.php b/special/SpecialNovaResources.php
index 156fb83..495daa1 100644
--- a/special/SpecialNovaResources.php
+++ b/special/SpecialNovaResources.php
@@ -36,7 +36,7 @@
                        return;
                }
                $this->userLDAP = new OpenStackNovaUser();
-               if ( ! $this->userLDAP->exists() ) {
+               if ( !$this->userLDAP->exists() ) {
                        $this->noCredentials();
                        return;
                }
@@ -159,7 +159,7 @@
                }
                if ( $instanceRows ) {
                        return $this->createResourceTable( $headers, 
$instanceRows );
-               } 
+               }
                return '';
        }
 
diff --git a/special/SpecialNovaRole.php b/special/SpecialNovaRole.php
index 1a1615f..781a90d 100644
--- a/special/SpecialNovaRole.php
+++ b/special/SpecialNovaRole.php
@@ -60,11 +60,11 @@
                        $rolemembers = $role->getMembers();
                        $member_keys = array();
                        foreach ( $projectmembers as $projectmember ) {
-                               if ( ! in_array( $projectmember, $rolemembers ) 
) {
+                               if ( !in_array( $projectmember, $rolemembers ) 
) {
                                        $member_keys[$projectmember] = 
$projectmember;
                                }
                        }
-                       if ( ! $member_keys ) {
+                       if ( !$member_keys ) {
                                $this->getOutput()->addWikiMsg( 
'openstackmanager-nomemberstoadd' );
                                return true;
                        }
@@ -76,7 +76,7 @@
                                'name' => 'members',
                        );
                } else {
-                       //TODO: display error
+                       // TODO: display error
                }
                $roleInfo['action'] = array(
                        'type' => 'hidden',
@@ -95,7 +95,7 @@
                );
                $roleInfo['returnto'] = array(
                        'type' => 'hidden',
-                       'default' => $this->getRequest()->getText('returnto'),
+                       'default' => $this->getRequest()->getText( 'returnto' ),
                        'name' => 'returnto',
                );
 
@@ -141,9 +141,9 @@
                                }
                        }
                } else {
-                       //TODO: display error
+                       // TODO: display error
                }
-               if ( ! $member_keys ) {
+               if ( !$member_keys ) {
                        $this->getOutput()->addWikiMsg( 
'openstackmanager-nomemberstoremove' );
                        return true;
                }
@@ -172,7 +172,7 @@
                );
                $roleInfo['returnto'] = array(
                        'type' => 'hidden',
-                       'default' => $this->getRequest()->getText('returnto'),
+                       'default' => $this->getRequest()->getText( 'returnto' ),
                        'name' => 'returnto',
                );
 
@@ -197,7 +197,7 @@
                $projectid = $formData['projectid'];
                if ( $projectid ) {
                        $project = OpenStackNovaProject::getProjectById( 
$projectid );
-                       if ( ! $project ) {
+                       if ( !$project ) {
                                $this->getOutput()->addWikiMsg( 
'openstackmanager-nonexistentproject' );
                                return true;
                        }
@@ -205,9 +205,9 @@
                        $rolename = $role->getRoleName();
                        $members = $formData['members'];
                } else {
-                       //TODO: display error
+                       // TODO: display error
                }
-               if ( ! $role ) {
+               if ( !$role ) {
                        $this->getOutput()->addWikiMsg( 
'openstackmanager-nonexistentrole' );
                        return true;
                }
@@ -240,16 +240,16 @@
                $projectid = $formData['projectid'];
                if ( $projectid ) {
                        $project = OpenStackNovaProject::getProjectById( 
$projectid );
-                       if ( ! $project ) {
+                       if ( !$project ) {
                                $this->getOutput()->addWikiMsg( 
'openstackmanager-nonexistentproject' );
                                return true;
                        }
                        $role = new OpenStackNovaRole( $formData['roleid'], 
$project );
                        $rolename = $role->getRoleName();
                } else {
-                       //TODO: display error
+                       // TODO: display error
                }
-               if ( ! $role ) {
+               if ( !$role ) {
                        $this->getOutput()->addWikiMsg( 
'openstackmanager-nonexistentrole' );
                        return true;
                }
diff --git a/special/SpecialNovaServiceGroup.php 
b/special/SpecialNovaServiceGroup.php
index cab9622..4994f4c 100644
--- a/special/SpecialNovaServiceGroup.php
+++ b/special/SpecialNovaServiceGroup.php
@@ -48,7 +48,7 @@
                $project = OpenStackNovaProject::getProjectByName( $projectname 
);
                if ( $project ) {
                        $group = 
OpenStackNovaServiceGroup::getServiceGroupByName( $groupName, $project );
-                       if ( ! $this->userLDAP->inRole( 'projectadmin', 
$projectname ) &&
+                       if ( !$this->userLDAP->inRole( 'projectadmin', 
$projectname ) &&
                                ( !$group->isMember( 
$this->userLDAP->getUsername() ) ) ) {
                                # We can add a member if we're an admin or if 
we're already in the security group.
                                $this->notInServiceGroup();
@@ -91,7 +91,7 @@
                                'help-message' => 
'openstackmanager-servicegrouprecursewarning'
                        );
                } else {
-                       //TODO: display error
+                       // TODO: display error
                }
                $groupInfo['action'] = array(
                        'type' => 'hidden',
@@ -110,7 +110,7 @@
                );
                $groupInfo['returnto'] = array(
                        'type' => 'hidden',
-                       'default' => $this->getRequest()->getText('returnto'),
+                       'default' => $this->getRequest()->getText( 'returnto' ),
                        'name' => 'returnto',
                );
 
@@ -184,7 +184,7 @@
                $this->getOutput()->setPageTitle( $this->msg( 
'openstackmanager-removeservicegroup' ) );
 
                $groupName = $this->getRequest()->getText( 'groupname' );
-               if ( ! $this->getRequest()->wasPosted() ) {
+               if ( !$this->getRequest()->wasPosted() ) {
                        $this->getOutput()->addWikiMsg( 
'openstackmanager-removeservicegroupconfirm', $groupName );
                }
                $projectInfo = array();
@@ -255,7 +255,7 @@
                $serviceGroups =  $project->getServiceGroups();
                if ( $serviceGroups ) {
                        $headers = array( 'openstackmanager-servicegroupname', 
'openstackmanager-members', 'openstackmanager-actions' );
-                       foreach ( $serviceGroups as $group) {
+                       foreach ( $serviceGroups as $group ) {
                                $groupName = $group->getGroupName();
                                $groupRow = array();
                                $this->pushResourceColumn( $groupRow, 
$groupName );
@@ -287,7 +287,7 @@
                $username = $this->userLDAP->getUsername();
 
                $success = $project->addServiceGroup( 
$formData['servicegroupname'], $username );
-               if ( ! $success ) {
+               if ( !$success ) {
                        $this->getOutput()->addWikiMsg( 
'openstackmanager-createservicegroupfailed' );
                        return false;
                }
@@ -313,7 +313,7 @@
                $projectname = $formData['projectname'];
                if ( $projectname ) {
                        $project = OpenStackNovaProject::getProjectByName( 
$projectname );
-                       if ( ! $project ) {
+                       if ( !$project ) {
                                $this->getOutput()->addWikiMsg( 
'openstackmanager-nonexistentproject' );
                                return true;
                        }
@@ -321,9 +321,9 @@
                        $members = $formData['members'];
                        $servicemembers = $formData['servicemembers'];
                } else {
-                       //TODO: display error
+                       // TODO: display error
                }
-               if ( ! $group ) {
+               if ( !$group ) {
                        $this->getOutput()->addWikiMsg( 
'openstackmanager-nonexistentgroup' );
                        return true;
                }
diff --git a/special/SpecialNovaSudoer.php b/special/SpecialNovaSudoer.php
index 78cd1ba..3b45588 100644
--- a/special/SpecialNovaSudoer.php
+++ b/special/SpecialNovaSudoer.php
@@ -30,19 +30,19 @@
                $this->projectName = $this->getRequest()->getText( 'project' );
                $this->project = OpenStackNovaProject::getProjectByName( 
$this->projectName );
                if ( $action === "create" ) {
-                       if ( ! $this->userLDAP->inProject( $this->projectName ) 
) {
+                       if ( !$this->userLDAP->inProject( $this->projectName ) 
) {
                                $this->notInProject( $this->project );
                                return;
                        }
                        $this->createSudoer();
                } elseif ( $action === "delete" ) {
-                       if ( ! $this->userLDAP->inProject( $this->projectName ) 
) {
+                       if ( !$this->userLDAP->inProject( $this->projectName ) 
) {
                                $this->notInProject( $this->project );
                                return;
                        }
                        $this->deleteSudoer();
                } elseif ( $action === "modify" ) {
-                       if ( ! $this->userLDAP->inProject( $this->projectName ) 
) {
+                       if ( !$this->userLDAP->inProject( $this->projectName ) 
) {
                                $this->notInProject( $this->project );
                                return;
                        }
@@ -58,7 +58,7 @@
        function createSudoer() {
                $this->setHeaders();
                $this->getOutput()->setPageTitle( $this->msg( 
'openstackmanager-modifysudoer' ) );
-               if ( ! $this->userLDAP->inRole( 'projectadmin', 
$this->projectName ) ) {
+               if ( !$this->userLDAP->inRole( 'projectadmin', 
$this->projectName ) ) {
                        $this->notInRole( 'projectadmin', $this->projectName );
                        return false;
                }
@@ -139,12 +139,12 @@
        function deleteSudoer() {
                $this->setHeaders();
                $this->getOutput()->setPageTitle( $this->msg( 
'openstackmanager-deletesudoer' ) );
-               if ( ! $this->userLDAP->inRole( 'projectadmin', 
$this->projectName ) ) {
+               if ( !$this->userLDAP->inRole( 'projectadmin', 
$this->projectName ) ) {
                        $this->notInRole( 'projectadmin', $this->projectName );
                        return false;
                }
                $sudoername = $this->getRequest()->getText( 'sudoername' );
-               if ( ! $this->getRequest()->wasPosted() ) {
+               if ( !$this->getRequest()->wasPosted() ) {
                        $this->getOutput()->addWikiMsg( 
'openstackmanager-deletesudoer-confirm', $sudoername );
                }
                $sudoerInfo = array();
@@ -181,7 +181,7 @@
        function modifySudoer() {
                $this->setHeaders();
                $this->getOutput()->setPageTitle( $this->msg( 
'openstackmanager-modifysudoer' ) );
-               if ( ! $this->userLDAP->inRole( 'projectadmin', 
$this->projectName ) ) {
+               if ( !$this->userLDAP->inRole( 'projectadmin', 
$this->projectName ) ) {
                        $this->notInRole( 'projectadmin', $this->projectName );
                        return false;
                }
@@ -196,11 +196,15 @@
                $commands = implode( "\n", $sudoer->getSudoerCommands() );
                $optionArray = $sudoer->getSudoerOptions();
                $requirePassword = false;
-               if ( ( $k = array_search( '!authenticate', $optionArray )) !== 
false ) {
+               $k = array_search( '!authenticate', $optionArray );
+               if ( $k !== false ) {
                        unset( $optionArray[$k] );
-               } elseif ( ( $k = array_search( 'authenticate', $optionArray )) 
!== false) {
-                       unset( $optionArray[$k] );
-                       $requirePassword = true;
+               } else {
+                       $k = array_search( 'authenticate', $optionArray );
+                       if ( $k !== false ) {
+                               unset( $optionArray[$k] );
+                               $requirePassword = true;
+                       }
                }
                $options = implode( "\n", $optionArray );
                $sudoerInfo = array();
@@ -276,7 +280,7 @@
                return true;
        }
 
-       function getSudoUsers( $projectName, $sudoer=null ) {
+       function getSudoUsers( $projectName, $sudoer = null ) {
                $project = OpenStackNovaProject::getProjectByName( $projectName 
);
                $projectuids = $project->getMemberUids();
                $projectserviceusers = $project->getServiceUsers();
@@ -292,7 +296,7 @@
                $projectGroup = "%" . $project->getProjectGroupName();
                $all_members = $this->msg( 'openstackmanager-allmembers' 
)->text();
                $user_keys[$all_members] = $all_members;
-               if ( in_array( 'ALL', $sudomembers ) || in_array ( 
$projectGroup, $sudomembers ) ) {
+               if ( in_array( 'ALL', $sudomembers ) || in_array( 
$projectGroup, $sudomembers ) ) {
                        $user_defaults[$all_members] = $all_members;
                }
 
@@ -315,7 +319,7 @@
                return array( 'keys' => $user_keys, 'defaults' => 
$user_defaults );
        }
 
-       function getSudoRunAsUsers( $projectName, $sudoer=null ) {
+       function getSudoRunAsUsers( $projectName, $sudoer = null ) {
                $project = OpenStackNovaProject::getProjectByName( $projectName 
);
                $projectuids = $project->getMemberUids();
                $projectserviceusers = $project->getServiceUsers();
@@ -338,7 +342,7 @@
                $projectGroup = "%" . $project->getProjectGroupName();
                $all_members = $this->msg( 'openstackmanager-allmembers' 
)->text();
                $runas_keys[$all_members] = $all_members;
-               if ( in_array ( $projectGroup, $runasmembers ) ) {
+               if ( in_array( $projectGroup, $runasmembers ) ) {
                        $runas_defaults[$all_members] = $all_members;
                }
 
@@ -481,7 +485,7 @@
        function removeALLFromUserKeys( $users ) {
                $newusers = array();
                foreach ( $users as $user ) {
-                       if ( ( $user == 'ALL' ) || ( $user == $this->msg( 
'openstackmanager-allmembers' )->text() )) {
+                       if ( ( $user == 'ALL' ) || ( $user == $this->msg( 
'openstackmanager-allmembers' )->text() ) ) {
                                $newusers[] = "%" . 
$this->project->getProjectGroupName();
                        } else {
                                $newusers[] = $user;
@@ -534,9 +538,9 @@
                } else {
                        $options[] = '!authenticate';
                }
-               $runasusers = 
$this->removeALLFromRunAsUserKeys($formData['runas']);
-               $success = OpenStackNovaSudoer::createSudoer( 
$formData['sudoername'], $formData['project'], 
$this->removeALLFromUserKeys($formData['users']), $runasusers, $commands, 
$options );
-               if ( ! $success ) {
+               $runasusers = $this->removeALLFromRunAsUserKeys( 
$formData['runas'] );
+               $success = OpenStackNovaSudoer::createSudoer( 
$formData['sudoername'], $formData['project'], $this->removeALLFromUserKeys( 
$formData['users'] ), $runasusers, $commands, $options );
+               if ( !$success ) {
                        $this->getOutput()->addWikiMsg( 
'openstackmanager-createsudoerfailed' );
                        return false;
                }
@@ -606,29 +610,29 @@
                        $projectserviceusers = $project->getServiceUsers();
                        $projectGroup = "%" . $project->getProjectGroupName();
 
-                       $users = 
$this->removeALLFromUserKeys($formData['users']);
+                       $users = $this->removeALLFromUserKeys( 
$formData['users'] );
                        $formerusers = $sudoer->getSudoerUsers();
                        foreach ( $formerusers as $candidate ) {
                                # Anything in this list that isn't a user or  
ALL
                                # wasn't exposed to user selection so needs to 
stay.
                                if ( $candidate != $projectGroup ) {
-                                       if ( ( ! in_array( $candidate, 
$projectuids ) ) && ( ! in_array( $candidate, $projectserviceusers ) ) ) {
+                                       if ( ( !in_array( $candidate, 
$projectuids ) ) && ( !in_array( $candidate, $projectserviceusers ) ) ) {
                                                $users[] = $candidate;
                                        }
                                }
                        }
 
-                       $runasusers = 
$this->removeALLFromRunAsUserKeys($formData['runas']);
+                       $runasusers = $this->removeALLFromRunAsUserKeys( 
$formData['runas'] );
                        foreach ( $sudoer->getSudoerRunAsUsers() as $candidate 
) {
                                if ( ( $candidate != $projectGroup ) && ( 
$candidate != 'ALL' ) ) {
-                                       if ( ( ! in_array( $candidate, 
$projectuids ) ) && ( ! in_array( $candidate, $projectserviceusers ) ) ) {
+                                       if ( ( !in_array( $candidate, 
$projectuids ) ) && ( !in_array( $candidate, $projectserviceusers ) ) ) {
                                                $runasusers[] = $candidate;
                                        }
                                }
                        }
 
                        $success = $sudoer->modifySudoer( $users, $runasusers, 
$commands, $options );
-                       if ( ! $success ) {
+                       if ( !$success ) {
                                $this->getOutput()->addWikiMsg( 
'openstackmanager-modifysudoerfailed' );
                                return true;
                        }
diff --git a/special/SpecialNovaVolume.php b/special/SpecialNovaVolume.php
index 3d1224e..2ad4b1e 100644
--- a/special/SpecialNovaVolume.php
+++ b/special/SpecialNovaVolume.php
@@ -42,25 +42,25 @@
                $action = $this->getRequest()->getVal( 'action' );
 
                if ( $action === "create" ) {
-                       if ( ! $this->userLDAP->inProject( $project ) ) {
+                       if ( !$this->userLDAP->inProject( $project ) ) {
                                $this->notInProject( $project );
                                return;
                        }
                        $this->createVolume();
                } elseif ( $action === "delete" ) {
-                       if ( ! $this->userLDAP->inProject( $project ) ) {
+                       if ( !$this->userLDAP->inProject( $project ) ) {
                                $this->notInProject( $project );
                                return;
                        }
                        $this->deleteVolume();
                } elseif ( $action === "attach" ) {
-                       if ( ! $this->userLDAP->inProject( $project ) ) {
+                       if ( !$this->userLDAP->inProject( $project ) ) {
                                $this->notInProject( $project );
                                return;
                        }
                        $this->attachVolume();
                } elseif ( $action === "detach" ) {
-                       if ( ! $this->userLDAP->inProject( $project ) ) {
+                       if ( !$this->userLDAP->inProject( $project ) ) {
                                $this->notInProject( $project );
                                return;
                        }
@@ -79,7 +79,7 @@
 
                $project = $this->getRequest()->getText( 'project' );
                $region = $this->getRequest()->getText( 'region' );
-               if ( ! $this->userLDAP->inRole( 'projectadmin', $project ) ) {
+               if ( !$this->userLDAP->inRole( 'projectadmin', $project ) ) {
                        $this->notInRole( 'projectadmin', $project );
                        return false;
                }
@@ -142,12 +142,12 @@
 
                $project = $this->getRequest()->getText( 'project' );
                $region = $this->getRequest()->getText( 'region' );
-               if ( ! $this->userLDAP->inRole( 'projectadmin', $project ) ) {
+               if ( !$this->userLDAP->inRole( 'projectadmin', $project ) ) {
                        $this->notInRole( 'projectadmin', $project );
                        return false;
                }
                $volumeid = $this->getRequest()->getText( 'volumeid' );
-               if ( ! $this->getRequest()->wasPosted() ) {
+               if ( !$this->getRequest()->wasPosted() ) {
                        $this->getOutput()->addWikiMsg( 
'openstackmanager-deletevolumequestion', $volumeid );
                }
                $volumeInfo = array();
@@ -192,7 +192,7 @@
 
                $project = $this->getRequest()->getText( 'project' );
                $region = $this->getRequest()->getText( 'region' );
-               if ( ! $this->userLDAP->inRole( 'projectadmin', $project ) ) {
+               if ( !$this->userLDAP->inRole( 'projectadmin', $project ) ) {
                        $this->notInRole( 'projectadmin', $project );
                        return false;
                }
@@ -274,7 +274,7 @@
 
                $project = $this->getRequest()->getText( 'project' );
                $region = $this->getRequest()->getText( 'region' );
-               if ( ! $this->userLDAP->inRole( 'projectadmin', $project ) ) {
+               if ( !$this->userLDAP->inRole( 'projectadmin', $project ) ) {
                        $this->notInRole( 'projectadmin', $project );
                        return false;
                }
@@ -434,7 +434,7 @@
         */
        function tryDeleteSubmit( $formData, $entryPoint = 'internal' ) {
                $volume = $this->userNova->getVolume( $formData['volumeid'] );
-               if ( ! $volume ) {
+               if ( !$volume ) {
                        $this->getOutput()->addWikiMsg( 
'openstackmanager-nonexistantvolume' );
                        return true;
                }
@@ -514,11 +514,11 @@
         */
        function getDrives() {
                $drives = array();
-               foreach ( range('a', 'z') as $letter ) {
+               foreach ( range( 'a', 'z' ) as $letter ) {
                        $drive = '/dev/vd' . $letter;
                        $drives[$drive] = $drive;
                }
-               foreach ( range('a', 'z') as $letter ) {
+               foreach ( range( 'a', 'z' ) as $letter ) {
                        $drive = '/dev/vda' . $letter;
                        $drives[$drive] = $drive;
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/359434
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I06f814d890b3bc455842aff1ddfbd302dfc40e35
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OpenStackManager
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <umherirrender_de...@web.de>
Gerrit-Reviewer: Hashar <has...@free.fr>
Gerrit-Reviewer: Legoktm <lego...@member.fsf.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to