Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not fatally fail on angular pages if an extension is missing #16533

Merged
merged 1 commit into from
Feb 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CRM/Extension/Container/Interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public function getPath($key);
*
* @param string $key
* Fully-qualified extension name.
*
* @throws \CRM_Extension_Exception_MissingException
*/
public function getResUrl($key);

Expand Down
13 changes: 11 additions & 2 deletions CRM/Extension/Mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,11 @@ public function keyToBasePath($key) {
*
* @return string
* url for resources in this extension
*
* @throws \CRM_Extension_Exception_MissingException
*/
public function keyToUrl($key) {
if ($key == 'civicrm') {
if ($key === 'civicrm') {
// CRM-12130 Workaround: If the domain's config_backend is NULL at the start of the request,
// then the Mapper is wrongly constructed with an empty value for $this->civicrmUrl.
if (empty($this->civicrmUrl)) {
Expand Down Expand Up @@ -339,6 +341,8 @@ public function getActiveModuleFiles($fresh = FALSE) {
*
* @return array
* (string $extKey => string $baseUrl)
*
* @throws \CRM_Extension_Exception_MissingException
*/
public function getActiveModuleUrls() {
// TODO optimization/caching
Expand All @@ -347,7 +351,12 @@ public function getActiveModuleUrls() {
foreach ($this->getModules() as $module) {
/** @var $module CRM_Core_Module */
if ($module->is_active) {
$urls[$module->name] = $this->keyToUrl($module->name);
try {
$urls[$module->name] = $this->keyToUrl($module->name);
}
catch (CRM_Extension_Exception_MissingException $e) {
CRM_Core_Session::setStatus(ts('An enabled extension is missing from the extensions directory') . ':' . $module->name);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't seem to bubble up - but I think it's clearer keeping it in

}
}
}
return $urls;
Expand Down