Set blank & color only if current db version supports it

This commit is contained in:
slawkens 2024-11-19 15:32:55 +01:00
parent 2c852dea5e
commit f4ddf2ba23

View File

@ -770,6 +770,8 @@ class Plugins {
*/
public static function installMenus($templateName, $menus, $clearOld = false)
{
global $db;
if ($clearOld) {
Menu::where('template', $templateName)->delete();
}
@ -804,10 +806,14 @@ class Plugins {
'link' => $link,
'category' => $category,
'ordering' => $i++,
'blank' => $blank,
'color' => $color,
];
// support for color and blank attributes
if($db->hasColumn(TABLE_PREFIX . 'menu', 'blank') && $db->hasColumn(TABLE_PREFIX . 'menu', 'color')) {
$insert_array['blank'] = $blank;
$insert_array['color'] = $color;
}
Menu::create($insert_array);
}
}