Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix PR 13619 sync menutype for admin menu
Fix PR #13619 "Sync menutype for admin menu and set client_id correct" so it does not make user-created menus disappear.
- Loading branch information
Showing
3 changed files
with
124 additions
and
5 deletions.
There are no files selected for viewing
42 changes: 41 additions & 1 deletion
42
administrator/components/com_admin/sql/updates/mysql/3.7.0-2017-01-17.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,42 @@ | ||
-- Sync menutype for admin menu and set client_id correct | ||
UPDATE `#__menu` SET `menutype` = 'main', `client_id` = 1 WHERE `menutype` = 'main' OR `menutype` = 'menu'; | ||
|
||
-- Note: This file had to be modified with Joomla 3.7.3 because the | ||
-- original version made site menus disappear if there were menu types | ||
-- "main" or "menu" defined for the site. | ||
|
||
-- Step 1: If there is any user-defined menu and menu type "main" for the site | ||
-- (client_id = 0), then change the menu type for the menu, any module and the | ||
-- menu type to something hopefully not being used yet. | ||
UPDATE `#__menu` | ||
SET `menutype` = 'main_is_reserved' | ||
WHERE `client_id` = 0 | ||
AND `menutype` = 'main' | ||
AND (SELECT COUNT(`id`) FROM `#__menu_types` WHERE `client_id` = 0 AND `menutype` = 'main') > 0; | ||
|
||
UPDATE `#__modules` | ||
SET `params` = REPLACE(`params`,'"menutype":"main"','"menutype":"main_is_reserved"') | ||
WHERE `client_id` = 0 | ||
AND (SELECT COUNT(`id`) FROM `#__menu_types` WHERE `client_id` = 0 AND `menutype` = 'main') > 0; | ||
|
||
UPDATE `#__menu_types` | ||
SET `menutype` = 'main_is_reserved' | ||
WHERE `client_id` = 0 | ||
AND `menutype` = 'main'; | ||
|
||
-- Step 2: What remains now are the main menu items, possibly with wrong | ||
-- client_id if there was nothing hit by step 1 because there was no record in | ||
-- the menu types table with client_id = 0. | ||
-- If there is a record in the menutype table we con't care because either | ||
-- it has client_id 1, then it is ok, or it does not exist (which is the normal | ||
-- case for the standard main menu). | ||
UPDATE `#__menu` | ||
SET `client_id` = 1 | ||
WHERE `menutype` = 'main'; | ||
|
||
-- Step 3: Synch menu type "menu" correct client_id if there is no user-defined | ||
-- menu type "menu" for either admin or site. | ||
UPDATE `#__menu` | ||
SET `menutype` = 'main', | ||
`client_id` = 1 | ||
WHERE `menutype` = 'menu' | ||
AND (SELECT COUNT(`id`) FROM `#__menu_types` WHERE `menutype` = 'menu') = 0; |
43 changes: 41 additions & 2 deletions
43
administrator/components/com_admin/sql/updates/postgresql/3.7.0-2017-01-17.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,42 @@ | ||
-- Sync menutype for admin menu and set client_id correct | ||
UPDATE "#__menu" SET "client_id" = 1 WHERE "menutype" = 'main' OR "menutype" = 'menu'; | ||
UPDATE "#__menu" SET "menutype" = 'main' WHERE "menutype" = 'main' OR "menutype" = 'menu'; | ||
|
||
-- Note: This file had to be modified with Joomla 3.7.3 because the | ||
-- original version made site menus disappear if there were menu types | ||
-- "main" or "menu" defined for the site. | ||
|
||
-- Step 1: If there is any user-defined menu and menu type "main" for the site | ||
-- (client_id = 0), then change the menu type for the menu, any module and the | ||
-- menu type to something hopefully not being used yet. | ||
UPDATE "#__menu" | ||
SET "menutype" = 'main_is_reserved' | ||
WHERE "client_id" = 0 | ||
AND "menutype" = 'main' | ||
AND (SELECT COUNT("id") FROM "#__menu_types" WHERE "client_id" = 0 AND "menutype" = 'main') > 0; | ||
|
||
UPDATE "#__modules" | ||
SET "params" = REPLACE("params",'"menutype":"main"','"menutype":"main_is_reserved"') | ||
WHERE "client_id" = 0 | ||
AND (SELECT COUNT("id") FROM "#__menu_types" WHERE "client_id" = 0 AND "menutype" = 'main') > 0; | ||
|
||
UPDATE "#__menu_types" | ||
SET "menutype" = 'main_is_reserved' | ||
WHERE "client_id" = 0 | ||
AND "menutype" = 'main'; | ||
|
||
-- Step 2: What remains now are the main menu items, possibly with wrong | ||
-- client_id if there was nothing hit by step 1 because there was no record in | ||
-- the menu types table with client_id = 0. | ||
-- If there is a record in the menutype table we con't care because either | ||
-- it has client_id 1, then it is ok, or it does not exist (which is the normal | ||
-- case for the standard main menu). | ||
UPDATE "#__menu" | ||
SET "client_id" = 1 | ||
WHERE "menutype" = 'main'; | ||
|
||
-- Step 3: Synch menu type "menu" correct client_id if there is no user-defined | ||
-- menu type "menu" for either admin or site. | ||
UPDATE "#__menu" | ||
SET "menutype" = 'main', | ||
"client_id" = 1 | ||
WHERE "menutype" = 'menu' | ||
AND (SELECT COUNT("id") FROM "#__menu_types" WHERE "menutype" = 'menu') = 0; |
44 changes: 42 additions & 2 deletions
44
administrator/components/com_admin/sql/updates/sqlazure/3.7.0-2017-01-17.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters