? ? Failure

User tests: Successful: Unsuccessful:

avatar IbrahimFathy19
IbrahimFathy19
15 Mar 2019

Pull Request for Issue # .

Summary of Changes

Installing sample data during the installation of Joomla assigns the user's id with a random number not the super user's id. And this warning shows up after installation.
image

Documentation Changes Required

I made a query to fetch the user id where name = "Super User".

avatar IbrahimFathy19 IbrahimFathy19 - open - 15 Mar 2019
avatar IbrahimFathy19 IbrahimFathy19 - change - 15 Mar 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 15 Mar 2019
Category Installation
avatar IbrahimFathy19 IbrahimFathy19 - change - 15 Mar 2019
Labels Added: ?
avatar infograf768 infograf768 - change - 15 Mar 2019
Title
Sample data installed with the admin's id
[4.0] Sample data installed with the admin's id
avatar infograf768 infograf768 - edited - 15 Mar 2019
avatar infograf768 infograf768 - change - 15 Mar 2019
Title
Sample data installed with the admin's id
[4.0] Sample data installed with the admin's id
avatar infograf768
infograf768 - comment - 15 Mar 2019

This will not work for custom distributions from language communities where the name of the Super User is in their language.
Screen Shot 2019-03-15 at 09 10 49

Therefore I rather suggest to use a similar code as found in:
https://github.com/joomla/joomla-cms/blob/4.0-dev/plugins/sampledata/multilang/multilang.php#L1326-L1368

avatar mbabker
mbabker - comment - 15 Mar 2019

This is honestly the wrong approach. If you follow the getUserId call you'll find that the user ID should only be re-generated if the user ID is not present in the session. So if it's not there when sample data is being installed, THAT is your bug and that needs to be addressed; there should not be a need to re-query the super user ID in this manner.

avatar IbrahimFathy19
IbrahimFathy19 - comment - 15 Mar 2019

This is honestly the wrong approach. If you follow the getUserId call you'll find that the user ID should only be re-generated if the user ID is not present in the session. So if it's not there when sample data is being installed, THAT is your bug and that needs to be addressed; there should not be a need to re-query the super user ID in this manner.

@mbabker
I thought of that too, and the solution would be removing install sample data during installation and make it after the user is logged in.
or once the user creates a joomla site, he is logged in.

avatar IbrahimFathy19
IbrahimFathy19 - comment - 15 Mar 2019

This will not work for custom distributions from language communities where the name of the Super User is in their language.
Screen Shot 2019-03-15 at 09 10 49

Therefore I rather suggest to use a similar code as found in:
https://github.com/joomla/joomla-cms/blob/4.0-dev/plugins/sampledata/multilang/multilang.php#L1326-L1368

@infograf768 I will give it a look

avatar infograf768
infograf768 - comment - 16 Mar 2019

hmm, after some thought, it seems that the issue we have with session not being forwarded further is the real issue.
I had remarked that when I found out that the chosen installed language is lost at some time during Joomla installation.

avatar chmst
chmst - comment - 19 Mar 2019

Just an idea: Could we add a user "sample data owner" (registered) when sample data are installed and use the ID of this user. It has the advantage that sample data later are easy to find and remove.


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

avatar chmst
chmst - comment - 19 Mar 2019

Just an idea: Could we add a user "sample data owner" (registered) when sample data are installed and use the ID of this user. It has the advantage that sample data later are easy to find and remove.


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

avatar infograf768
infograf768 - comment - 19 Mar 2019

@wilsonge
could we solve this session issue at installation time? It is really bothering.

avatar Bakual
Bakual - comment - 19 Mar 2019

Actually, the whole sample data should be removed from the installation in 4.0.
There is no point in having the sample data module when we still maintain the sample data SQL files.

avatar brianteeman
brianteeman - comment - 19 Mar 2019

Beat me to it. I thought that decision had already been made - just the sql hasnt been removed yet

avatar wilsonge
wilsonge - comment - 19 Mar 2019

It is approved to remove it in the installer - just needs removing (BUT with the exception that the ability to use a custom sql file for template clubs is left in - because it's been made clear by many smaller template clubs they don't feel comfortable with the php api) - probably a different named file that similar to https://github.com/joomla/joomla-cms/blob/4.0-dev/installation/src/Model/DatabaseModel.php#L676

avatar Bakual
Bakual - comment - 19 Mar 2019

Does it even need to be a different named file? Template clubs could use the exact same file as localised packs use. Or do the template clubs base their pack on localised ones?

avatar wilsonge
wilsonge - comment - 21 Mar 2019

Does it even need to be a different named file? Template clubs could use the exact same file as localised packs use. Or do the template clubs base their pack on localised ones?

I have no clue. But I don't want to find out the hard way and it's 8 lines to add a second if statement which seems like a small price to pay

avatar Schmidie64 Schmidie64 - test_item - 19 Oct 2019 - Tested unsuccessfully
avatar Schmidie64
Schmidie64 - comment - 19 Oct 2019

I have tested this item ? unsuccessfully on fe5a80c

I can not understand the mistake. When I try to install sample data, the author is set correctly. Probably because I was logged in as an admin. Maybe this PR can be closed?


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

avatar richard67
richard67 - comment - 10 Nov 2019

Meanwhile you can chose the user name of the super user at installation, so selecting by user name = "Super User" like this PR here does is definitely wrong.

avatar richard67
richard67 - comment - 10 Nov 2019

@Schmidie64 The PR was about installing sample data during installation, not after installation.

Sample data installation shall be removed from the installation process, as far as I know, if that has not been done yet, and for after installation I see no issue.

Also I see no issue in the updateUserIds routine like it is now without this PR: After installation any user ids in database are set to the right value (if nothing was forgotten in that routine, which one of my recent PR's corrected for the workflows table).

So I think this PR is just wrong.

avatar wilsonge
wilsonge - comment - 10 Nov 2019

The data should be in the session. If it’s not we’ve got another bug somewhere. We’ve removed sample data after install. So going to close

avatar wilsonge wilsonge - close - 10 Nov 2019
avatar wilsonge wilsonge - change - 10 Nov 2019
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2019-11-10 11:42:35
Closed_By wilsonge
Labels Added: ?

Add a Comment

Login with GitHub to post a comment