+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018 |
+ | Copyright CiviCRM LLC (c) 2004-2019 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
* uninstalling extensions.
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
*/
class CRM_Extension_Manager {
/**
// 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(
+ 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.', [
1 => $newInfo->key,
2 => $oldPath,
- )));
+ ]));
}
break;
*/
public function getStatuses() {
if (!is_array($this->statuses)) {
- $this->statuses = array();
+ $this->statuses = [];
foreach ($this->fullContainer->getKeys() as $key) {
$this->statuses[$key] = self::STATUS_UNINSTALLED;
private function _getInfoTypeHandler($key) {
$info = $this->mapper->keyToInfo($key); // throws Exception
if (array_key_exists($info->type, $this->typeManagers)) {
- return array($info, $this->typeManagers[$info->type]);
+ return [$info, $this->typeManagers[$info->type]];
}
else {
throw new CRM_Extension_Exception("Unrecognized extension type: " . $info->type);
$info = $this->createInfoFromDB($key);
if ($info) {
if (array_key_exists($info->type, $this->typeManagers)) {
- return array($info, $this->typeManagers[$info->type]);
+ return [$info, $this->typeManagers[$info->type]];
}
else {
throw new CRM_Extension_Exception("Unrecognized extension type: " . $info->type);
* @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'),
- 2 => array($info->key, 'String'),
- ));
+ CRM_Core_DAO::executeQuery('UPDATE civicrm_extension SET is_active = %1 where full_name = %2', [
+ 1 => [$isActive, 'Integer'],
+ 2 => [$info->key, 'String'],
+ ]);
}
/**
public function findInstallRequirements($keys) {
$infos = $this->mapper->getAllInfos();
$todoKeys = array_unique($keys); // array(string $key).
- $doneKeys = array(); // array(string $key => 1);
+ $doneKeys = []; // array(string $key => 1);
$sorter = new \MJS\TopSort\Implementations\FixedArraySort();
while (!empty($todoKeys)) {
$info = @$infos[$key];
if ($this->getStatus($key) === self::STATUS_INSTALLED) {
- $sorter->add($key, array());
+ $sorter->add($key, []);
}
elseif ($info && $info->requires) {
$sorter->add($key, $info->requires);
$todoKeys = array_merge($todoKeys, $info->requires);
}
else {
- $sorter->add($key, array());
+ $sorter->add($key, []);
}
}
return $sorter->sort();
* List of extension keys, including dependencies, in order of removal.
*/
public function findDisableRequirements($keys) {
- $INSTALLED = array(
+ $INSTALLED = [
self::STATUS_INSTALLED,
self::STATUS_INSTALLED_MISSING,
- );
+ ];
$installedInfos = $this->filterInfosByStatus($this->mapper->getAllInfos(), $INSTALLED);
$revMap = CRM_Extension_Info::buildReverseMap($installedInfos);
$todoKeys = array_unique($keys);
- $doneKeys = array();
+ $doneKeys = [];
$sorter = new \MJS\TopSort\Implementations\FixedArraySort();
while (!empty($todoKeys)) {
$todoKeys = array_merge($todoKeys, $requiredBys);
}
else {
- $sorter->add($key, array());
+ $sorter->add($key, []);
}
}
return $sorter->sort();
* @return array
*/
protected function filterInfosByStatus($infos, $filterStatuses) {
- $matches = array();
+ $matches = [];
foreach ($infos as $k => $v) {
if (in_array($this->getStatus($v->key), $filterStatuses)) {
$matches[$k] = $v;