INFRA-132 - CRM/Extension - phpcbf
authorTim Otten <totten@civicrm.org>
Tue, 6 Jan 2015 21:10:53 +0000 (13:10 -0800)
committerTim Otten <totten@civicrm.org>
Tue, 6 Jan 2015 23:06:49 +0000 (15:06 -0800)
CRM/Extension/Downloader.php
CRM/Extension/Manager.php
CRM/Extension/Manager/Payment.php
CRM/Extension/Mapper.php
CRM/Extension/System.php

index 054b6b6419a390a06fb8948fb7b79bb5388c0868..b8f152e3b0da35b491a4fbcef63ed3e2192b4673 100644 (file)
@@ -144,6 +144,7 @@ class CRM_Extension_Downloader {
     switch ($result) {
       case CRM_Utils_HttpClient::STATUS_OK:
         return TRUE;
+
       default:
         return FALSE;
     }
index 86a897d3e81440f929a7ad1a12a500e4614b72e8..db6716c8e06aa2047fa2a1e6958947407bb96dfe 100644 (file)
@@ -150,17 +150,20 @@ class CRM_Extension_Manager {
           )));
         }
         break;
+
       case self::STATUS_INSTALLED_MISSING:
       case self::STATUS_DISABLED_MISSING:
-      // the extension does not exist in any container; we're free to put it anywhere
+        // the extension does not exist in any container; we're free to put it anywhere
         $tgtPath = $this->defaultContainer->getBaseDir() . DIRECTORY_SEPARATOR . $newInfo->key;
         list ($oldInfo, $typeManager) = $this->_getMissingInfoTypeHandler($newInfo->key); // throws Exception
         break;
+
       case self::STATUS_UNKNOWN:
-      // the extension does not exist in any container; we're free to put it anywhere
+        // the extension does not exist in any container; we're free to put it anywhere
         $tgtPath = $this->defaultContainer->getBaseDir() . DIRECTORY_SEPARATOR . $newInfo->key;
         $oldInfo = $typeManager = NULL;
         break;
+
       default:
         throw new CRM_Extension_Exception("Cannot install or enable extension: {$newInfo->key}");
     }
@@ -174,6 +177,7 @@ class CRM_Extension_Manager {
           throw new CRM_Extension_Exception("Failed to move $tmpCodeDir to $tgtPath");
         }
         break;
+
       case self::STATUS_INSTALLED:
       case self::STATUS_INSTALLED_MISSING:
       case self::STATUS_DISABLED:
@@ -186,6 +190,7 @@ class CRM_Extension_Manager {
         $this->_updateExtensionEntry($newInfo);
         $typeManager->onPostReplace($oldInfo, $newInfo);
         break;
+
       default:
         throw new CRM_Extension_Exception("Cannot install or enable extension: {$newInfo->key}");
     }
@@ -215,18 +220,21 @@ class CRM_Extension_Manager {
         case self::STATUS_INSTALLED:
           // ok, nothing to do
           break;
+
         case self::STATUS_DISABLED:
           // re-enable it
           $typeManager->onPreEnable($info);
           $this->_setExtensionActive($info, 1);
           $typeManager->onPostEnable($info);
           break;
+
         case self::STATUS_UNINSTALLED:
           // install anew
           $typeManager->onPreInstall($info);
           $this->_createExtensionEntry($info);
           $typeManager->onPostInstall($info);
           break;
+
         case self::STATUS_UNKNOWN:
         default:
           throw new CRM_Extension_Exception("Cannot install or enable extension: $key");
@@ -245,13 +253,16 @@ class CRM_Extension_Manager {
         case self::STATUS_INSTALLED:
           // ok, nothing to do
           break;
+
         case self::STATUS_DISABLED:
           // re-enable it
           break;
+
         case self::STATUS_UNINSTALLED:
           // install anew
           $typeManager->onPostPostInstall($info);
           break;
+
         case self::STATUS_UNKNOWN:
         default:
           throw new CRM_Extension_Exception("Cannot install or enable extension: $key");
@@ -294,17 +305,20 @@ class CRM_Extension_Manager {
           $this->_setExtensionActive($info, 0);
           $typeManager->onPostDisable($info);
           break;
+
         case self::STATUS_INSTALLED_MISSING:
           list ($info, $typeManager) = $this->_getMissingInfoTypeHandler($key); // throws Exception
           $typeManager->onPreDisable($info);
           $this->_setExtensionActive($info, 0);
           $typeManager->onPostDisable($info);
           break;
+
         case self::STATUS_DISABLED:
         case self::STATUS_DISABLED_MISSING:
         case self::STATUS_UNINSTALLED:
           // ok, nothing to do
           break;
+
         case self::STATUS_UNKNOWN:
         default:
           throw new CRM_Extension_Exception("Cannot disable unknown extension: $key");
@@ -332,27 +346,31 @@ class CRM_Extension_Manager {
     // TODO: to mitigate the risk of crashing during installation, scan
     // keys/statuses/types before doing anything
 
-   foreach ($keys as $key) {
+    foreach ($keys as $key) {
       switch ($origStatuses[$key]) {
         case self::STATUS_INSTALLED:
         case self::STATUS_INSTALLED_MISSING:
           throw new CRM_Extension_Exception("Cannot uninstall extension; disable it first: $key");
-          break;
+
+        break;
         case self::STATUS_DISABLED:
           list ($info, $typeManager) = $this->_getInfoTypeHandler($key); // throws Exception
           $typeManager->onPreUninstall($info);
           $this->_removeExtensionEntry($info);
           $typeManager->onPostUninstall($info);
           break;
+
         case self::STATUS_DISABLED_MISSING:
           list ($info, $typeManager) = $this->_getMissingInfoTypeHandler($key); // throws Exception
           $typeManager->onPreUninstall($info);
           $this->_removeExtensionEntry($info);
           $typeManager->onPostUninstall($info);
           break;
+
         case self::STATUS_UNINSTALLED:
           // ok, nothing to do
           break;
+
         case self::STATUS_UNKNOWN:
         default:
           throw new CRM_Extension_Exception("Cannot disable unknown extension: $key");
index 3dd9c27a2afdcbf13eb0d1f8bfe5fa0d721080da..02b879f2d29cfebefcc52fb2b7d08e12534b37b2 100644 (file)
@@ -36,7 +36,7 @@
 class CRM_Extension_Manager_Payment extends CRM_Extension_Manager_Base {
 
   /**
-   @var CRM_Extension_Mapper
+  @var CRM_Extension_Mapper
    */
   protected $mapper;
 
@@ -235,7 +235,7 @@ class CRM_Extension_Manager_Payment extends CRM_Extension_Manager_Base {
           1 => array($info->name, 'String'),
         )
       );
-      if ($dao->fetch()) $paymentProcessor = array(
+      if ($dao->fetch()) $paymentProcessor = array(
         'id' => -1,
         'name' => $dao->title,
         'payment_processor_type_id' => $dao->id,
@@ -251,8 +251,10 @@ class CRM_Extension_Manager_Payment extends CRM_Extension_Manager_Base {
         'is_recur' => $dao->is_recur,
         'billing_mode' => $dao->billing_mode,
         'payment_type' => $dao->payment_type,
-      );
-      else CRM_Core_Error::fatal("Unable to find payment processor in " . __CLASS__ . '::' . __METHOD__);
+        );
+      }
+      else { CRM_Core_Error::fatal("Unable to find payment processor in " . __CLASS__ . '::' . __METHOD__);
+      }
     }
 
     // In the case of uninstall, check for instances of PP first.
@@ -280,7 +282,7 @@ class CRM_Extension_Manager_Payment extends CRM_Extension_Manager_Base {
 
       default:
         CRM_Core_Session::setStatus(ts( "Unrecognized payment hook (%1) in %2::%3",
-                        array(1 => $method, 2 =>  __CLASS__ , 3 => __METHOD__) ),
+                        array(1 => $method, 2 => __CLASS__ , 3 => __METHOD__) ),
                         '', 'error');
     }
   }
index 593429c873a7e727ffb9469ba2c72456a1963128..fdf7c3c2ae7ad936ef2123c09202842d7a06dc87 100755 (executable)
@@ -102,10 +102,10 @@ class CRM_Extension_Mapper {
       $this->civicrmUrl = rtrim($config->resourceBase, '/');
     }
     if ($civicrmPath) {
-      $this->civicrmPath = rtrim($civicrmPath,'/');
+      $this->civicrmPath = rtrim($civicrmPath, '/');
     } else {
       global $civicrm_root;
-      $this->civicrmPath = rtrim($civicrm_root,'/');
+      $this->civicrmPath = rtrim($civicrm_root, '/');
     }
   }
 
index a2714840e57cb810b902de97574c1b7cad63e45d..405be0055083de33d69c6321b2f911bc627f3e95 100644 (file)
@@ -235,8 +235,8 @@ class CRM_Extension_System {
 
       // boolean false means don't try to check extensions
       // http://issues.civicrm.org/jira/browse/CRM-10575
-      if($url === false) {
-        $this->_repoUrl = false;
+      if($url === FALSE) {
+        $this->_repoUrl = FALSE;
       }
       else {
         $this->_repoUrl = CRM_Utils_System::evalUrl($url);