+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018 |
+ | Copyright CiviCRM LLC (c) 2004-2019 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
* module-extensions.
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
*/
class CRM_Extension_Mapper {
/**
* @var array (key => CRM_Extension_Info)
*/
- protected $infos = array();
+ protected $infos = [];
/**
* @var array
* array(array('prefix' => $, 'file' => $))
*/
public function getActiveModuleFiles($fresh = FALSE) {
- $config = CRM_Core_Config::singleton();
- if ($config->isUpgradeMode() || !defined('CIVICRM_DSN')) {
- return array(); // hmm, ok
+ if (!defined('CIVICRM_DSN')) {
+ // hmm, ok
+ return [];
}
$moduleExtensions = NULL;
}
if (!is_array($moduleExtensions)) {
+ $compat = CRM_Extension_System::getCompatibilityInfo();
+
// Check canonical module list
- $moduleExtensions = array();
+ $moduleExtensions = [];
$sql = '
SELECT full_name, file
FROM civicrm_extension
';
$dao = CRM_Core_DAO::executeQuery($sql);
while ($dao->fetch()) {
+ if (!empty($compat[$dao->full_name]['force-uninstall'])) {
+ continue;
+ }
try {
- $moduleExtensions[] = array(
+ $moduleExtensions[] = [
'prefix' => $dao->file,
'filePath' => $this->keyToPath($dao->full_name),
- );
+ ];
}
catch (CRM_Extension_Exception $e) {
// Putting a stub here provides more consistency
// in how getActiveModuleFiles when racing between
// dirty file-removals and cache-clears.
CRM_Core_Session::setStatus($e->getMessage(), '', 'error');
- $moduleExtensions[] = array(
+ $moduleExtensions[] = [
'prefix' => $dao->file,
'filePath' => NULL,
- );
+ ];
}
}
*/
public function getActiveModuleUrls() {
// TODO optimization/caching
- $urls = array();
+ $urls = [];
$urls['civicrm'] = $this->keyToUrl('civicrm');
foreach ($this->getModules() as $module) {
/** @var $module CRM_Core_Module */
* Ex: array("org.foo.bar").
*/
public function getKeysByPath($pattern) {
- $keys = array();
+ $keys = [];
if (CRM_Utils_String::endsWith($pattern, '*')) {
$prefix = rtrim($pattern, '*');
* CRM_Core_Module
*/
public function getModules() {
- $result = array();
+ $result = [];
$dao = new CRM_Core_DAO_Extension();
$dao->type = 'module';
$dao->find();
}
public function refresh() {
- $this->infos = array();
+ $this->infos = [];
$this->moduleExtensions = NULL;
if ($this->cache) {
$this->cache->delete($this->cacheKey . '_moduleFiles');