+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018 |
+ | Copyright CiviCRM LLC (c) 2004-2019 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
* system.
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
*/
class CRM_Extension_System {
private static $singleton;
* List of configuration values required by the extension system.
* Missing values will be guessed based on $config.
*/
- public function __construct($parameters = array()) {
+ public function __construct($parameters = []) {
$config = CRM_Core_Config::singleton();
$parameters['extensionsDir'] = CRM_Utils_Array::value('extensionsDir', $parameters, $config->extensionsDir);
$parameters['extensionsURL'] = CRM_Utils_Array::value('extensionsURL', $parameters, $config->extensionsURL);
if (!array_key_exists('domain_id', $parameters)) {
$parameters['domain_id'] = CRM_Core_Config::domainID();
}
- ksort($parameters); // guaranteed ordering - useful for md5(serialize($parameters))
+ // guaranteed ordering - useful for md5(serialize($parameters))
+ ksort($parameters);
$this->parameters = $parameters;
}
*/
public function getFullContainer() {
if ($this->fullContainer === NULL) {
- $containers = array();
+ $containers = [];
if ($this->getDefaultContainer()) {
$containers['default'] = $this->getDefaultContainer();
*/
public function getManager() {
if ($this->manager === NULL) {
- $typeManagers = array(
+ $typeManagers = [
'payment' => new CRM_Extension_Manager_Payment($this->getMapper()),
'report' => new CRM_Extension_Manager_Report(),
'search' => new CRM_Extension_Manager_Search(),
'module' => new CRM_Extension_Manager_Module($this->getMapper()),
- );
+ ];
$this->manager = new CRM_Extension_Manager($this->getFullContainer(), $this->getDefaultContainer(), $this->getMapper(), $typeManagers);
}
return $this->manager;
$this->downloader = new CRM_Extension_Downloader(
$this->getManager(),
$basedir,
- CRM_Utils_File::tempdir() // WAS: $config->extensionsDir . DIRECTORY_SEPARATOR . 'tmp';
+ // WAS: $config->extensionsDir . DIRECTORY_SEPARATOR . 'tmp';
+ CRM_Utils_File::tempdir()
);
}
return $this->downloader;
*/
public function getCache() {
if ($this->cache === NULL) {
- $cacheGroup = md5(serialize(array('ext', $this->parameters)));
+ $cacheGroup = md5(serialize(['ext', $this->parameters]));
// Extension system starts before container. Manage our own cache.
- $this->cache = CRM_Utils_Cache::create(array(
+ $this->cache = CRM_Utils_Cache::create([
'name' => $cacheGroup,
- 'type' => array('*memory*', 'SqlGroup', 'ArrayCache'),
+ 'type' => ['*memory*', 'SqlGroup', 'ArrayCache'],
'prefetch' => TRUE,
- ));
+ ]);
}
return $this->cache;
}
return $this->_repoUrl;
}
+ /**
+ * Returns a list keyed by extension key
+ *
+ * @return array
+ */
+ public static function getCompatibilityInfo() {
+ if (!isset(Civi::$statics[__CLASS__]['compatibility'])) {
+ Civi::$statics[__CLASS__]['compatibility'] = json_decode(file_get_contents(Civi::paths()->getPath('[civicrm.root]/extension-compatibility.json')), TRUE);
+ }
+ return Civi::$statics[__CLASS__]['compatibility'];
+ }
+
/**
* Take an extension's raw XML info and add information about the
* extension's status on the local system.
switch ($extensionRow['status']) {
case CRM_Extension_Manager::STATUS_UNINSTALLED:
- $extensionRow['statusLabel'] = ''; // ts('Uninstalled');
+ // ts('Uninstalled');
+ $extensionRow['statusLabel'] = '';
break;
case CRM_Extension_Manager::STATUS_DISABLED:
break;
case CRM_Extension_Manager::STATUS_INSTALLED:
- $extensionRow['statusLabel'] = ts('Enabled'); // ts('Installed');
+ // ts('Installed');
+ $extensionRow['statusLabel'] = ts('Enabled');
break;
case CRM_Extension_Manager::STATUS_DISABLED_MISSING:
break;
case CRM_Extension_Manager::STATUS_INSTALLED_MISSING:
- $extensionRow['statusLabel'] = ts('Enabled (Missing)'); // ts('Installed');
+ // ts('Installed');
+ $extensionRow['statusLabel'] = ts('Enabled (Missing)');
break;
default: