? Pending

User tests: Successful: Unsuccessful:

avatar alikon
alikon
29 Dec 2021

Summary of Changes

added the missed node to the #__assets table

Testing Instructions

code review
or
enable the log

Actual result BEFORE applying this Pull Request

image

Expected result AFTER applying this Pull Request

asset found for module Login Support

avatar alikon alikon - open - 29 Dec 2021
avatar alikon alikon - change - 29 Dec 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 29 Dec 2021
Category SQL Installation
avatar alikon alikon - change - 29 Dec 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 29 Dec 2021
Category SQL Installation SQL Installation Postgresql
avatar alikon alikon - change - 29 Dec 2021
The description was changed
avatar alikon alikon - edited - 29 Dec 2021
avatar alikon alikon - change - 29 Dec 2021
The description was changed
avatar alikon alikon - edited - 29 Dec 2021
avatar alikon alikon - change - 29 Dec 2021
Title
missing com_modules.module.90 from asset
[4] fix missing com_modules.module.90 from #__assets table
avatar alikon alikon - edited - 29 Dec 2021
avatar richard67
richard67 - comment - 29 Dec 2021

@alikon I've made suggestions for the mysql file regarding lft and rgt. The same should also be changed to the postgresql file.

avatar alikon
alikon - comment - 30 Dec 2021

@richard67
as we are adding a child to a node that already have childs

i've followed these steps:

  1. identify the rgt value of the parent
SELECT @myRight := rgt FROM `#__assets` where name ='com_modules' 

result @myRight = 128

  1. make room for the new child
UPDATE `#__assets` SET rgt = rgt + 2 WHERE rgt > @myRight;
UPDATE `#__assets` SET lft = lft + 2 WHERE lft > @myRight;
  1. add the new child to the parent
INSERT INTO `#__assets` (`id`, `parent_id`, `lft`, `rgt`, `level`, `name`, `title`, `rules`)
VALUES(89, 18, @myRight + 1, @myRight + 2, 2, 'com_modules.module.90', 'Login Support', '{}');
avatar richard67
richard67 - comment - 30 Dec 2021

@alikon The procedure seems right to me. Maybe I've made a mistake when checking manually. Will check again later.

avatar richard67
richard67 - comment - 30 Dec 2021

Hmm, but shouldn't the rgt value of record 18 (com_modules) be changed, too, when adding new items with parent = 18?

avatar richard67
richard67 - comment - 30 Dec 2021

I think step 2 should be:

UPDATE `#__assets` SET rgt = rgt + 2 WHERE rgt >= @myRight;
UPDATE `#__assets` SET lft = lft + 2 WHERE lft > @myRight;

I.e. for the rgt value use ">=" and for the lft value ">" in the condition.

Then the parent's rgt value will be updated in the right way, too.

Or you leave these conditions like you wrote but have to update that one record later.

Update: But the ">=" is only true if you insert a child of that record for which you got @myRight. If you insert on the same level 1 and not like here level 2, it would be the ">".

avatar richard67
richard67 - comment - 30 Dec 2021

Ok, I think I have it. Will mark my previous suggestions as resolved and make a new one.

avatar alikon
alikon - comment - 30 Dec 2021

ok so let's review it for this pr and for future reference

as we are adding a child to a parent that already have childs

these steps needs to be done:

  1. identify the rgt value of the parent and take note of the parent_id as well
SELECT @myRight := rgt FROM `#__assets` where name ='com_modules' 

result @myRight = 128

  1. make room for the new child
UPDATE `#__assets` SET rgt = rgt + 2 WHERE rgt >= @myRight;
UPDATE `#__assets` SET lft = lft + 2 WHERE lft > @myRight;
  1. add the new child to the parent
INSERT INTO `#__assets` (`id`, `parent_id`, `lft`, `rgt`, `level`, `name`, `title`, `rules`)
VALUES(89, 18, @myRight , @myRight + 1, 2, 'com_modules.module.90', 'Login Support', '{}');
  1. check that the new child is a child of the parent
SELECT node.name, node.parent_id
FROM `#__assets` AS node,
        `#__assets` AS parent
WHERE node.lft BETWEEN parent.lft AND parent.rgt
        AND parent.name = 'com_modules'
ORDER BY node.lft
avatar richard67
richard67 - comment - 30 Dec 2021

@alikon Yes that looks ok to me. The result should be the same as my latest review suggestion.

avatar richard67
richard67 - comment - 30 Dec 2021

@alikon Normally (in a world where the features of relational databases are really used), an insert trigger would do that for us.

Unfortunately as we support 2 kinds of databases, it would mean we either maintain triggers for each database kind in their programming language, or we implement the triggers in external libraries in the programming language of our choice and let the database triggers use these external procedures. Both would be possible.

avatar alikon
alikon - comment - 30 Dec 2021

i would prefer to go with a stored procedure, yeah maybe for J7 or J9 ?

avatar richard67
richard67 - comment - 30 Dec 2021

I have tested this item successfully on d2a7bb1

Code review + real test.

Hint for other testers for real test: Just check the "Log" tab of the debug when having "Debug System" switched on on any 4.0 or 4.1 installation. You will see the 2 logs about the missing asset for module 90. Then make a new installation with the PR applied and check the same. The log is empty now.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36481.

avatar richard67 richard67 - test_item - 30 Dec 2021 - Tested successfully
avatar wilsonge wilsonge - change - 30 Dec 2021
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2021-12-30 12:39:05
Closed_By wilsonge
avatar wilsonge wilsonge - close - 30 Dec 2021
avatar wilsonge wilsonge - merge - 30 Dec 2021
avatar wilsonge
wilsonge - comment - 30 Dec 2021

Thanks!

Add a Comment

Login with GitHub to post a comment