diff --git a/amp_conf/htdocs/admin/libraries/BMO/Modules.class.php b/amp_conf/htdocs/admin/libraries/BMO/Modules.class.php index 9dadf8d65f..a626df4811 100644 --- a/amp_conf/htdocs/admin/libraries/BMO/Modules.class.php +++ b/amp_conf/htdocs/admin/libraries/BMO/Modules.class.php @@ -522,10 +522,13 @@ public function checkConflicts($module=false) { } $type = $value['type']; $conflictModInfo = $this->modclass->getinfo($value['rawname']); - if(!isset($conflictModInfo[$value['rawname']])) { - //I mean this should never happen but you never know - return; + + // Module Not Installed in the system so no need to check for conflicts, if retun false crash the recolection of the data + if(!isset($conflictModInfo[$value['rawname']])) + { + continue; } + //reassign $conflictModInfo = $conflictModInfo[$value['rawname']]; //only deal with one state diff --git a/amp_conf/htdocs/admin/page.modules.php b/amp_conf/htdocs/admin/page.modules.php index 501449ce33..92c3f590b0 100644 --- a/amp_conf/htdocs/admin/page.modules.php +++ b/amp_conf/htdocs/admin/page.modules.php @@ -395,7 +395,7 @@ echo _("Updating Hooks..."); try { $FreePBX->Hooks->updateBMOHooks(); - }catch(\Exception) {} + } catch(\Exception $e) {} echo _("Done")."
"; echo ""; echo "

"; @@ -463,11 +463,14 @@ $dependerrors = $modulef->checkdepends($previous_data); $conflicterrors = $FreePBX->Modules->checkConflicts($previous_data); $rollbackerrors = false; - if ($conflicterrors['breaking'] && is_array($conflicterrors['issues'][$modules[$module]['name']]) && !empty($conflicterrors['issues'][$modules[$module]['name']])) { + if (!empty($conflicterrors['breaking'] ?? null)) { $rollbackerrors = true; $skipaction = true; - $errorstext[] = sprintf(_("%s cannot be upgraded: %s Please try again after the conflicts have been resolved."), - "".$modules[$module]['name']."",''); + foreach($conflicterrors['issues'] as $conflictmodule => $issue) + { + $errorstext[] = sprintf(_("%s cannot be upgraded: %s Please try again after the conflicts have been resolved."), + sprintf("%s", $modules[$module]['name']), sprintf('', implode('
  • ',$issue))); + } } if (is_array($dependerrors)) { $rollbackerrors = true; @@ -523,12 +526,15 @@ $errorstext[] = sprintf(_("%s cannot be upgraded: %s Please try again after the dependencies have been installed."), "".$modules[$module]['name']."",''); } - if ($conflicterrors['breaking'] && isset($conflicterrors['issues'][$modules[$module]['name']]) && !empty($conflicterrors['issues'][$modules[$module]['name']]) && $action != 'upgradeignoreconflicts') { + if (!empty($conflicterrors['breaking'] ?? null)) { $errorflag = true; $checkdone = true; $skipaction = true; - $errorstext[] = sprintf(_("%s cannot be upgraded: %s Please try again after the conflicts have been corrected."), - "".$modules[$module]['name']."",''); + foreach($conflicterrors['issues'] as $conflictmodule => $issue) + { + $errorstext[] = sprintf(_("%s cannot be upgraded: %s Please try again after the conflicts have been resolved."), + sprintf("%s", $modules[$module]['name']), sprintf('', implode('
  • ',$issue))); + } } if(!$errorflag && !$checkdone){ switch ( version_compare_freepbx($modules[$module]['dbversion'], $trackinfo['version'])) { @@ -571,11 +577,14 @@ $errorstext[] = sprintf(_("%s cannot be installed: %s Please try again after the dependencies have been installed."), "".$modules[$module]['name']."",''); } - if(isset($conflicterrors['breaking']) && $conflicterrors['breaking'] && is_array($conflicterrors['issues'][$modules[$module]['name']]) && !empty($conflicterrors['issues'][$modules[$module]['name']])) { + if (!empty($conflicterrors['breaking'] ?? null)) { $skipaction = true; $di = true; - $errorstext[] = sprintf(_("%s cannot be installed: %s Please try again after the conflicts have been installed."), - "".$modules[$module]['name']."",''); + foreach($conflicterrors['issues'] as $conflictmodule => $issue) + { + $errorstext[] = sprintf(_("%s cannot be installed: %s Please try again after the conflicts have been resolved."), + sprintf("%s", $modules[$module]['name']), sprintf('', implode('
  • ',$issue))); + } } if(!empty($trackinfo) && (!isset($di) || !$di)){ $actionstext[] = sprintf(_("%s %s will be downloaded and installed and switched to the %s track"), "".$modules[$module]['name']."", "".$trackinfo['version']."","".$track.""); @@ -617,11 +626,14 @@ $errorstext[] = sprintf((($modules[$module]['status'] == MODULE_STATUS_NEEDUPGRADE) ? _("%s cannot be upgraded: %s Please try again after the dependencies have been installed.") : _("%s cannot be installed: %s Please try again after the dependencies have been installed.") ), "".$modules[$module]['name']."",''); } - if (isset($conflicterrors['breaking']) && $conflicterrors['breaking'] && is_array($conflicterrors['issues'][$modules[$module]['name']]) && !empty($conflicterrors['issues'][$modules[$module]['name']])) { + if (!empty($conflicterrors['breaking'] ?? null)) { $skipaction = true; $issues = true; - $errorstext[] = sprintf(_("%s cannot be upgraded: %s Please try again after the conflicts have been resolved."), - "".$modules[$module]['name']."",''); + foreach($conflicterrors['issues'] as $conflictmodule => $issue) + { + $errorstext[] = sprintf(_("%s cannot be upgraded: %s Please try again after the conflicts have been resolved."), + sprintf("%s", $modules[$module]['name']), sprintf('', implode('
  • ',$issue))); + } } if(!$issues){ if ($modules[$module]['status'] == MODULE_STATUS_NEEDUPGRADE) { @@ -642,11 +654,14 @@ $errorstext[] = sprintf(_("%s cannot be enabled: %s Please try again after the dependencies have been installed."), "".$modules[$module]['name']."",''); } - if ($conflicterrors['breaking'] && is_array($conflicterrors['issues'][$modules[$module]['name']]) && !empty($conflicterrors['issues'][$modules[$module]['name']])) { + if (!empty($conflicterrors['breaking'] ?? null)) { $skipaction = true; $issues = true; - $errorstext[] = sprintf(_("%s cannot be enabled: %s Please try again after the conflicts have been resolved."), - "".$modules[$module]['name']."",''); + foreach($conflicterrors['issues'] as $conflictmodule => $issue) + { + $errorstext[] = sprintf(_("%s cannot be enabled: %s Please try again after the conflicts have been resolved."), + sprintf("%s", $modules[$module]['name']), sprintf('', implode('
  • ',$issue))); + } } if(!$issues){ $actionstext[] = sprintf(_("%s %s will be enabled"), "".$modules[$module]['name']."", "".$modules[$module]['dbversion']."");