Skip to content
Open
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
9 changes: 6 additions & 3 deletions amp_conf/htdocs/admin/libraries/BMO/Modules.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
47 changes: 31 additions & 16 deletions amp_conf/htdocs/admin/page.modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@
echo _("Updating Hooks...");
try {
$FreePBX->Hooks->updateBMOHooks();
}catch(\Exception) {}
} catch(\Exception $e) {}
echo _("Done")."<br />";
echo "</div>";
echo "<hr /><br />";
Expand Down Expand Up @@ -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."),
"<strong>".$modules[$module]['name']."</strong>",'<strong><ul><li>'.implode('</li><li>',$rollbackconflicts ?? '').'</li></ul></strong>');
foreach($conflicterrors['issues'] as $conflictmodule => $issue)
{
$errorstext[] = sprintf(_("%s cannot be upgraded: %s Please try again after the conflicts have been resolved."),
sprintf("<strong>%s</strong>", $modules[$module]['name']), sprintf('<strong><ul><li>%s</li></ul></strong>', implode('</li><li>',$issue)));
}
}
if (is_array($dependerrors)) {
$rollbackerrors = true;
Expand Down Expand Up @@ -523,12 +526,15 @@
$errorstext[] = sprintf(_("%s cannot be upgraded: %s Please try again after the dependencies have been installed."),
"<strong>".$modules[$module]['name']."</strong>",'<strong><ul><li>'.implode('</li><li>',$dependerrors).'</li></ul></strong>');
}
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."),
"<strong>".$modules[$module]['name']."</strong>",'<strong><ul><li>'.implode('</li><li>',$conflicterrors['issues'][$modules[$module]['name']]).'</li></ul></strong>');
foreach($conflicterrors['issues'] as $conflictmodule => $issue)
{
$errorstext[] = sprintf(_("%s cannot be upgraded: %s Please try again after the conflicts have been resolved."),
sprintf("<strong>%s</strong>", $modules[$module]['name']), sprintf('<strong><ul><li>%s</li></ul></strong>', implode('</li><li>',$issue)));
}
}
if(!$errorflag && !$checkdone){
switch ( version_compare_freepbx($modules[$module]['dbversion'], $trackinfo['version'])) {
Expand Down Expand Up @@ -571,11 +577,14 @@
$errorstext[] = sprintf(_("%s cannot be installed: %s Please try again after the dependencies have been installed."),
"<strong>".$modules[$module]['name']."</strong>",'<strong><ul><li>'.implode('</li><li>',$dependerrors).'</li></ul></strong>');
}
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."),
"<strong>".$modules[$module]['name']."</strong>",'<strong><ul><li>'.implode('</li><li>',$conflicterrors['issues'][$modules[$module]['name']]).'</li></ul></strong>');
foreach($conflicterrors['issues'] as $conflictmodule => $issue)
{
$errorstext[] = sprintf(_("%s cannot be installed: %s Please try again after the conflicts have been resolved."),
sprintf("<strong>%s</strong>", $modules[$module]['name']), sprintf('<strong><ul><li>%s</li></ul></strong>', implode('</li><li>',$issue)));
}
}
if(!empty($trackinfo) && (!isset($di) || !$di)){
$actionstext[] = sprintf(_("%s %s will be downloaded and installed and switched to the %s track"), "<strong>".$modules[$module]['name']."</strong>", "<strong>".$trackinfo['version']."</strong>","<strong>".$track."</strong>");
Expand Down Expand Up @@ -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.") ),
"<strong>".$modules[$module]['name']."</strong>",'<strong><ul><li>'.implode('</li><li>',$dependerrors).'</li></ul></strong>');
}
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."),
"<strong>".$modules[$module]['name']."</strong>",'<strong><ul><li>'.implode('</li><li>',$conflicterrors['issues'][$modules[$module]['name']]).'</li></ul></strong>');
foreach($conflicterrors['issues'] as $conflictmodule => $issue)
{
$errorstext[] = sprintf(_("%s cannot be upgraded: %s Please try again after the conflicts have been resolved."),
sprintf("<strong>%s</strong>", $modules[$module]['name']), sprintf('<strong><ul><li>%s</li></ul></strong>', implode('</li><li>',$issue)));
}
}
if(!$issues){
if ($modules[$module]['status'] == MODULE_STATUS_NEEDUPGRADE) {
Expand All @@ -642,11 +654,14 @@
$errorstext[] = sprintf(_("%s cannot be enabled: %s Please try again after the dependencies have been installed."),
"<strong>".$modules[$module]['name']."</strong>",'<strong><ul><li>'.implode('</li><li>',$dependserrors).'</li></ul></strong>');
}
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."),
"<strong>".$modules[$module]['name']."</strong>",'<strong><ul><li>'.implode('</li><li>',$conflicterrors['issues'][$modules[$module]['name']]).'</li></ul></strong>');
foreach($conflicterrors['issues'] as $conflictmodule => $issue)
{
$errorstext[] = sprintf(_("%s cannot be enabled: %s Please try again after the conflicts have been resolved."),
sprintf("<strong>%s</strong>", $modules[$module]['name']), sprintf('<strong><ul><li>%s</li></ul></strong>', implode('</li><li>',$issue)));
}
}
if(!$issues){
$actionstext[] = sprintf(_("%s %s will be enabled"), "<strong>".$modules[$module]['name']."</strong>", "<strong>".$modules[$module]['dbversion']."</strong>");
Expand Down