Skip to content

Commit e4a6b8c

Browse files
committed
Bugfix: When upgrading a Boost Union installation from the ancient pre-smart-menu-era to a recent version, Boost Union tried to access a table which does not exist yet, resolves #1085 (#1091)
1 parent 2087b46 commit e4a6b8c

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Changes
66

77
### Unreleased
88

9+
* 2025-11-04 - Bugfix: When upgrading a Boost Union installation from the ancient pre-smart-menu-era to a recent version, Boost Union tried to access a table which does not exist yet, resolves #1085
910
* 2025-11-03 - Glitch: upgrade.php did not match install.xml regarding the theme_boost_union_snippets table, resolves #1062
1011
* 2025-11-03 - Improvement: Use human-understandable values in the background position settings, resolves #1086
1112
* 2025-10-23 - Feature: Add a type for smart menu item to use mailto links, resolves #702

classes/smartmenu_item.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
use context_system;
3030
use stdClass;
31+
use xmldb_table;
3132
use cache;
3233
use core\output\html_writer;
3334
use core_course\external\course_summary_exporter;
@@ -1879,6 +1880,15 @@ public static function image_filepickeroptions() {
18791880
public static function get_all_fa_icons() {
18801881
global $DB;
18811882

1883+
// Check if the menuitems table exists before trying to query it.
1884+
// This prevents errors during upgrades from versions where this table does not exist yet.
1885+
$dbman = $DB->get_manager();
1886+
$table = new xmldb_table('theme_boost_union_menuitems');
1887+
if (!$dbman->table_exists($table)) {
1888+
// If table doesn't exist, return empty array.
1889+
return [];
1890+
}
1891+
18821892
// Define the query to search for icons in the menu items table.
18831893
$sql = "SELECT DISTINCT menuicon
18841894
FROM {theme_boost_union_menuitems}

0 commit comments

Comments
 (0)