Skip to content

Commit 9e4ef37

Browse files
committed
Change menu items url for subdir installs, fixed double subdiretory path on successful install redirect.
1 parent 225ae01 commit 9e4ef37

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

install/controller/index.php

+16
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
use function Vvveb\session as sess;
2828
use function Vvveb\setLanguage;
2929
use Vvveb\Sql\LanguageSQL;
30+
use Vvveb\Sql\menuSQL;
3031
use Vvveb\Sql\RoleSQL;
3132
use Vvveb\Sql\SiteSQL;
3233
use Vvveb\System\Core\View;
@@ -362,13 +363,28 @@ function install() {
362363
@\Vvveb\setConfig('app.cache.driver', 'APCu');
363364
}
364365

366+
if (V_SUBDIR_INSTALL) {
367+
//add subdir path to menu links
368+
$menus = new menuSQL();
369+
370+
foreach ([1, 5] as $menu_id) { //main menu and footer menu id's
371+
$menuItems = $menus->getMenus(['menu_id' => $menu_id, 'language_id' => 1])['menus'] ?? [];
372+
373+
foreach ($menuItems as $menuItem) {
374+
$data = ['url' => V_SUBDIR_INSTALL . $menuItem['url'], 'menu_item_content' => []];
375+
$menus->editMenuItem(['menu_item' => $data, 'menu_item_id' => $menuItem['menu_item_id']]);
376+
}
377+
}
378+
}
379+
365380
if ($error) {
366381
$this->view->error[] = $error;
367382
}
368383

369384
$success = __('Installation succesful!');
370385
$this->view->success[] = $success;
371386
$admin_path = \Vvveb\adminPath();
387+
$admin_path = str_replace(V_SUBDIR_INSTALL, '', $admin_path);
372388
$location = preg_replace('@/install.*$@', $admin_path . "/index.php?success=$success&errors=$error", ($_SERVER['REQUEST_URI'] ?? ''));
373389

374390
header("Location: $location");

install/sql/mysqli/menu.sql

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-- Menu
2+
3+
import(/admin/menu.sql);

install/sql/pgsql/menu.sql

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-- Menu
2+
3+
import(/admin/menu.sql);

install/sql/sqlite/menu.sql

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-- Menu
2+
3+
import(/admin/menu.sql);

0 commit comments

Comments
 (0)