X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FExtension%2FMapper.php;h=8615513566bbc5fa9e738fca291139cce5849c39;hb=eeca7960db033b9ee3511f6bf7d1217b1b5caed9;hp=12f624529b6a88902f234382f9280a93799f56fb;hpb=3d023ead1624cb26e8c5685b8a58f49690c31da3;p=civicrm-core.git diff --git a/CRM/Extension/Mapper.php b/CRM/Extension/Mapper.php index 12f624529b..358d3a9103 100644 --- a/CRM/Extension/Mapper.php +++ b/CRM/Extension/Mapper.php @@ -1,9 +1,9 @@ CRM_Extension_Info) */ - protected $infos = array(); + protected $infos = []; /** * @var array @@ -277,17 +277,17 @@ class CRM_Extension_Mapper { public function getActiveModuleFiles($fresh = FALSE) { $config = CRM_Core_Config::singleton(); if ($config->isUpgradeMode() || !defined('CIVICRM_DSN')) { - return array(); // hmm, ok + return []; // hmm, ok } $moduleExtensions = NULL; if ($this->cache && !$fresh) { - $moduleExtensions = $this->cache->get($this->cacheKey . '/moduleFiles'); + $moduleExtensions = $this->cache->get($this->cacheKey . '_moduleFiles'); } if (!is_array($moduleExtensions)) { // Check canonical module list - $moduleExtensions = array(); + $moduleExtensions = []; $sql = ' SELECT full_name, file FROM civicrm_extension @@ -297,25 +297,25 @@ class CRM_Extension_Mapper { $dao = CRM_Core_DAO::executeQuery($sql); while ($dao->fetch()) { 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, - ); + ]; } } if ($this->cache) { - $this->cache->set($this->cacheKey . '/moduleFiles', $moduleExtensions); + $this->cache->set($this->cacheKey . '_moduleFiles', $moduleExtensions); } } return $moduleExtensions; @@ -329,7 +329,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 +352,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 +410,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,10 +458,10 @@ class CRM_Extension_Mapper { } public function refresh() { - $this->infos = array(); + $this->infos = []; $this->moduleExtensions = NULL; if ($this->cache) { - $this->cache->delete($this->cacheKey . '/moduleFiles'); + $this->cache->delete($this->cacheKey . '_moduleFiles'); } // FIXME: How can code so code wrong be so right? CRM_Extension_System::singleton()->getClassLoader()->refresh();