<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
* uninstalling extensions.
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
public $statuses;
/**
+ * @param CRM_Extension_Container_Interface $fullContainer
* @param CRM_Extension_Container_Basic|FALSE $defaultContainer
+ * @param CRM_Extension_Mapper $mapper
+ * @param $typeManagers
*/
function __construct(CRM_Extension_Container_Interface $fullContainer, $defaultContainer, CRM_Extension_Mapper $mapper, $typeManagers) {
$this->fullContainer = $fullContainer;
$tgtPath = $this->fullContainer->getPath($newInfo->key);
if (! CRM_Utils_File::isChildPath($this->defaultContainer->getBaseDir(), $tgtPath)) {
// force installation in the default-container
+ $oldPath = $tgtPath;
$tgtPath = $this->defaultContainer->getBaseDir() . DIRECTORY_SEPARATOR . $newInfo->key;
CRM_Core_Session::setStatus(ts('A copy of the extension (%1) is in a system folder (%2). The system copy will be preserved, but the new copy will be used.', array(
1 => $newInfo->key,
$oldInfo = $typeManager = NULL;
break;
default:
- throw new CRM_Extension_Exception("Cannot install or enable extension: $key");
+ throw new CRM_Extension_Exception("Cannot install or enable extension: {$newInfo->key}");
}
// move the code!
$typeManager->onPostReplace($oldInfo, $newInfo);
break;
default:
- throw new CRM_Extension_Exception("Cannot install or enable extension: $key");
+ throw new CRM_Extension_Exception("Cannot install or enable extension: {$newInfo->key}");
}
$this->refresh();
/**
* Determine the status of an extension
*
+ * @param $key
+ *
* @return string constant (STATUS_INSTALLED, STATUS_DISABLED, STATUS_UNINSTALLED, STATUS_UNKNOWN)
*/
public function getStatus($key) {
/**
* Find the $info and $typeManager for a $key
*
- * @return array (0 => CRM_Extension_Info, 1 => CRM_Extension_Manager_Interface)
+ * @param $key
+ *
* @throws CRM_Extension_Exception
+ * @return array (0 => CRM_Extension_Info, 1 => CRM_Extension_Manager_Interface)
*/
private function _getInfoTypeHandler($key) {
$info = $this->mapper->keyToInfo($key); // throws Exception
/**
* Find the $info and $typeManager for a $key
*
- * @return array (0 => CRM_Extension_Info, 1 => CRM_Extension_Manager_Interface)
+ * @param $key
+ *
* @throws CRM_Extension_Exception
+ * @return array (0 => CRM_Extension_Info, 1 => CRM_Extension_Manager_Interface)
*/
private function _getMissingInfoTypeHandler($key) {
$info = $this->createInfoFromDB($key);
}
}
+ /**
+ * @param CRM_Extension_Info $info
+ *
+ * @return bool
+ */
private function _createExtensionEntry(CRM_Extension_Info $info) {
$dao = new CRM_Core_DAO_Extension();
$dao->label = $info->label;
return (bool) ($dao->insert());
}
+ /**
+ * @param CRM_Extension_Info $info
+ *
+ * @return bool
+ */
private function _updateExtensionEntry(CRM_Extension_Info $info) {
$dao = new CRM_Core_DAO_Extension();
$dao->full_name = $info->key;
}
}
+ /**
+ * @param CRM_Extension_Info $info
+ *
+ * @throws CRM_Extension_Exception
+ */
private function _removeExtensionEntry(CRM_Extension_Info $info) {
$dao = new CRM_Core_DAO_Extension();
$dao->full_name = $info->key;
} // else: post-condition already satisified
}
+ /**
+ * @param CRM_Extension_Info $info
+ * @param $isActive
+ */
private function _setExtensionActive(CRM_Extension_Info $info, $isActive) {
CRM_Core_DAO::executeQuery('UPDATE civicrm_extension SET is_active = %1 where full_name = %2', array(
1 => array($isActive, 'Integer'),
* Auto-generate a place-holder for a missing extension using info from
* database.
*
+ * @param $key
* @return CRM_Extension_Info|NULL
*/
public function createInfoFromDB($key) {