mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 01:39:22 +02:00
Auto clear old menu entries on install
This commit is contained in:
parent
6cd8b7697d
commit
c8d4e7d186
@ -712,17 +712,15 @@ class Plugins {
|
|||||||
* @param string $templateName
|
* @param string $templateName
|
||||||
* @param array $categories
|
* @param array $categories
|
||||||
*/
|
*/
|
||||||
public static function installMenus($templateName, $categories)
|
public static function installMenus($templateName, $categories, $clearOld = true)
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
if (!$db->hasTable(TABLE_PREFIX . 'menu')) {
|
if (!$db->hasTable(TABLE_PREFIX . 'menu')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if menus already exist
|
if ($clearOld) {
|
||||||
$menuInstalled = Menu::where('template', $templateName)->select('id')->first();
|
Menu::where('template', $templateName)->delete();
|
||||||
if ($menuInstalled) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($categories as $category => $menus) {
|
foreach ($categories as $category => $menus) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user