X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FExtension%2FMapper.php;h=fd828e4fe771e54a8a85776317fdf969e521ba48;hb=8b056441a3578c3e29f545865cbc951ddaa740c0;hp=38ff7d1951b78812ad7790f25547ecffd6c691b9;hpb=0287d2706caeb5b779f8378f6490670c6ee88bd2;p=civicrm-core.git diff --git a/CRM/Extension/Mapper.php b/CRM/Extension/Mapper.php index 38ff7d1951..fd828e4fe7 100644 --- a/CRM/Extension/Mapper.php +++ b/CRM/Extension/Mapper.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 5 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2018 | + | Copyright CiviCRM LLC (c) 2004-2019 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -42,7 +42,7 @@ * module-extensions. * * @package CRM - * @copyright CiviCRM LLC (c) 2004-2018 + * @copyright CiviCRM LLC (c) 2004-2019 */ class CRM_Extension_Mapper { @@ -63,7 +63,7 @@ class CRM_Extension_Mapper { /** * @var array (key => CRM_Extension_Info) */ - protected $infos = array(); + protected $infos = []; /** * @var array @@ -275,9 +275,9 @@ class CRM_Extension_Mapper { * 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; @@ -286,8 +286,10 @@ class CRM_Extension_Mapper { } if (!is_array($moduleExtensions)) { + $compat = CRM_Extension_System::getCompatibilityInfo(); + // Check canonical module list - $moduleExtensions = array(); + $moduleExtensions = []; $sql = ' SELECT full_name, file FROM civicrm_extension @@ -296,21 +298,24 @@ class CRM_Extension_Mapper { '; $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, - ); + ]; } } @@ -329,7 +334,7 @@ class CRM_Extension_Mapper { */ public function getActiveModuleUrls() { // TODO optimization/caching - $urls = array(); + $urls = []; $urls['civicrm'] = $this->keyToUrl('civicrm'); foreach ($this->getModules() as $module) { /** @var $module CRM_Core_Module */ @@ -352,7 +357,7 @@ class CRM_Extension_Mapper { * Ex: array("org.foo.bar"). */ public function getKeysByPath($pattern) { - $keys = array(); + $keys = []; if (CRM_Utils_String::endsWith($pattern, '*')) { $prefix = rtrim($pattern, '*'); @@ -410,7 +415,7 @@ class CRM_Extension_Mapper { * CRM_Core_Module */ public function getModules() { - $result = array(); + $result = []; $dao = new CRM_Core_DAO_Extension(); $dao->type = 'module'; $dao->find(); @@ -458,7 +463,7 @@ class CRM_Extension_Mapper { } public function refresh() { - $this->infos = array(); + $this->infos = []; $this->moduleExtensions = NULL; if ($this->cache) { $this->cache->delete($this->cacheKey . '_moduleFiles');