)));
}
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}");
}
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:
$this->_updateExtensionEntry($newInfo);
$typeManager->onPostReplace($oldInfo, $newInfo);
break;
+
default:
throw new CRM_Extension_Exception("Cannot install or enable extension: {$newInfo->key}");
}
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");
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");
$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");
// 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");
class CRM_Extension_Manager_Payment extends CRM_Extension_Manager_Base {
/**
- @var CRM_Extension_Mapper
+ @var CRM_Extension_Mapper
*/
protected $mapper;
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,
'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.
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');
}
}