? ? Language Change PR-4.3-dev Pending

User tests: Successful: Unsuccessful:

avatar Hackwar
Hackwar
25 Jul 2022

This PR adds a method to install Joomla via command line to simplify API tests and installations with one-click-setups. The new installation method can be triggered by running php installation/joomla.php install in the root of the Joomla folder. The different options are documented by running php installation/joomla.php help install.

All options can be given either by option directly on the command line or when running the install command interactively. If a default value is given for an option and that option is not defined, that default value is taken.

Summary of Changes

This adds a new CLI entry file, similar to cli/joomla.php to the installation with all necessary steps to run the installation. The code uses as much of the current installation as possible and validates the options from the setup.xml file.

joomla-cli-options

Testing Instructions

  1. Run php installation/joomla.php install in your installation and check that afterwards Joomla is properly installed.
  2. Run php installation/joomla.php install with all necessary CLI options

If you are using a dev version (checked out the GIT version) the installation folder is preserved, otherwise the folder is deleted.

Documentation Changes Required

The CLI installation is documented here: https://docs.joomla.org/J4.x:Joomla_CLI_Installation as well as in installation/INSTALL.

Acknowledgement

I'd like to thank Mittwald for supporting this improvement.

avatar Hackwar Hackwar - open - 25 Jul 2022
avatar Hackwar Hackwar - change - 25 Jul 2022
Status New Pending
avatar Hackwar Hackwar - change - 25 Jul 2022
Labels Added: ? PR-4.3-dev
avatar joomla-cms-bot joomla-cms-bot - change - 25 Jul 2022
Category Unit Tests Installation Libraries
avatar brianteeman
brianteeman - comment - 25 Jul 2022

excited to try this. would it not make more sense for it to be in the cli folder?

avatar Hackwar Hackwar - change - 25 Jul 2022
The description was changed
avatar Hackwar Hackwar - edited - 25 Jul 2022
avatar Hackwar
Hackwar - comment - 25 Jul 2022

Unfortunately the application in the /cli folder does only work when Joomla is already installed. Since the installer should also be removed when the installation is done, it needs to be part of the /installation folder.

avatar brianteeman
brianteeman - comment - 25 Jul 2022

Unfortunately the application in the /cli folder does only work when Joomla is already installed. Since the installer should also be removed when the installation is done, it needs to be part of the /installation folder.

Fair enough

avatar brianteeman
brianteeman - comment - 25 Jul 2022

Please use the same terminology and field order as in the regular web site install

image

Especially as the error messages are based on the web install terminology

image

avatar brianteeman
brianteeman - comment - 25 Jul 2022

Passwords should not be displayed in plain text to prevent over-the -shoulder attacks
image

avatar brianteeman
brianteeman - comment - 25 Jul 2022

Create and fill database...OK

==>

Creating and populating database...OK

Its a statement of what is happening and not a question.

Same for the others

avatar brianteeman
brianteeman - comment - 25 Jul 2022

Please add some sort of installation complete message. Otherwise no one would know if the installer has bombed out or completed

image

avatar brianteeman
brianteeman - comment - 25 Jul 2022

other than these cosmetic issues it appears to work

avatar alikon
alikon - comment - 25 Jul 2022

there isn't a prebuild for 4.3 branch yet ?

avatar Hackwar
Hackwar - comment - 25 Jul 2022

Please add some sort of installation complete message. Otherwise no one would know if the installer has bombed out or completed

image

It actually contains a success message and your installation did indeed fail. Good question why. Looking into it.

avatar brianteeman
brianteeman - comment - 25 Jul 2022

It actually contains a success message and your installation did indeed fail. Good question why. Looking into it.

The files in the folder installation were removed but not the folder. (There is an existing issue on that I believe?) BUT there should have been some sort of message

avatar richard67
richard67 - comment - 25 Jul 2022

The files in the folder installation were removed but not the folders. (There is an existing issue on that I believe?)

I am not aware of any existing issue.

avatar brianteeman
brianteeman - comment - 25 Jul 2022

The files in the folder installation were removed but not the folders. (There is an existing issue on that I believe?)

I am not aware of any existing issue.

#37909

avatar richard67
richard67 - comment - 25 Jul 2022

Ah that one.

avatar Hackwar
Hackwar - comment - 26 Jul 2022

Please use the same terminology and field order as in the regular web site install

image

Especially as the error messages are based on the web install terminology

image

I reordered the fields. Unfortunately we need different text for the CLI options than for the web installer. Since the CLI is always in english, the current solution is acceptable for me.

avatar Hackwar
Hackwar - comment - 26 Jul 2022

Passwords should not be displayed in plain text to prevent over-the -shoulder attacks image

The symfony console package does not allow to hide this input in any way.

avatar Hackwar
Hackwar - comment - 26 Jul 2022

Create and fill database...OK

==>

Creating and populating database...OK

Its a statement of what is happening and not a question.

Same for the others

Done

avatar Hackwar
Hackwar - comment - 26 Jul 2022

there isn't a prebuild for 4.3 branch yet ?

Not yet, but I will create a PR to fix that. I don't want to do this in this PR.

avatar brianteeman
brianteeman - comment - 26 Jul 2022

The language you are using is not correct!!

avatar Hackwar
Hackwar - comment - 26 Jul 2022

there isn't a prebuild for 4.3 branch yet ?

Not yet, but I will create a PR to fix that. I don't want to do this in this PR.

Done #38331, #38332

avatar brianteeman
brianteeman - comment - 26 Jul 2022

Passwords should not be displayed in plain text to prevent over-the -shoulder attacks image

The symfony console package does not allow to hide this input in any way.

of course it does - just look at the cli for creating a user

avatar brianteeman
brianteeman - comment - 26 Jul 2022

I reordered the fields.

why? What is the reasoning. A lot of thought went into the ordering.

avatar brianteeman
brianteeman - comment - 26 Jul 2022

I have tested this item ? unsuccessfully on 6ca4269


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

avatar brianteeman brianteeman - test_item - 26 Jul 2022 - Tested unsuccessfully
avatar Hackwar
Hackwar - comment - 26 Jul 2022

I reordered the fields.

why? What is the reasoning. A lot of thought went into the ordering.

You asked for it... I reordered the fields the way they are displayed in CLI, not in the web installer.

avatar Hackwar
Hackwar - comment - 26 Jul 2022

Passwords should not be displayed in plain text to prevent over-the -shoulder attacks image

The symfony console package does not allow to hide this input in any way.

of course it does - just look at the cli for creating a user

mea culpa. You are right. Going to fix that tomorrow.

avatar brianteeman
brianteeman - comment - 26 Jul 2022

I mis read that as being - no I wont change the order as I have reordered them here.

But please change the language strings as suggested - what you have done is wrong

avatar alikon
alikon - comment - 27 Jul 2022

from a 1st look
database not on localhost doesn't work
image

avatar alikon
alikon - comment - 27 Jul 2022

on a 2nd look
the db_password can be empty in the web installer

avatar Hackwar
Hackwar - comment - 28 Jul 2022

Passwords should not be displayed in plain text to prevent over-the -shoulder attacks image

Fixed.

avatar Hackwar
Hackwar - comment - 28 Jul 2022

from a 1st look database not on localhost doesn't work image

fixed.

avatar brianteeman
brianteeman - comment - 28 Jul 2022

When in development mode you do not need to remove the installation folder.

If you try to start the web installer on an already installed site it does NOT create a new install. (iirc it checks for the presence of configuration.php)

The cli script does not have this check

avatar alikon
alikon - comment - 28 Jul 2022

the password of the administrator account is still visible
plus
there is no option to set a db_prefix a random one is generated

avatar Hackwar
Hackwar - comment - 28 Jul 2022

When in development mode you do not need to remove the installation folder.

If you try to start the web installer on an already installed site it does NOT create a new install. (iirc it checks for the presence of configuration.php)

The cli script does not have this check

When the installation folder is not deleted on an installed site in dev mode, you can still go through the installation.

avatar Hackwar
Hackwar - comment - 28 Jul 2022

the password of the administrator account is still visible plus there is no option to set a db_prefix a random one is generated

If you don't set a db_prefix, a random one is generated. If you want to set a prefix, you need to set that as command line option.

avatar brianteeman
brianteeman - comment - 28 Jul 2022

When in development mode you do not need to remove the installation folder.
If you try to start the web installer on an already installed site it does NOT create a new install. (iirc it checks for the presence of configuration.php)
The cli script does not have this check

When the installation folder is not deleted on an installed site in dev mode, you can still go through the installation.

No you can not. Why is it always such a battle for you to accept what anyoine else says.

// Check if a configuration file already exists.
if (
file_exists(JPATH_CONFIGURATION . '/configuration.php')
&& (filesize(JPATH_CONFIGURATION . '/configuration.php') > 10)
&& !file_exists(JPATH_INSTALLATION . '/index.php')
) {
header('Location: ../index.php');
exit();
}

avatar Hackwar
Hackwar - comment - 28 Jul 2022

When in development mode you do not need to remove the installation folder.
If you try to start the web installer on an already installed site it does NOT create a new install. (iirc it checks for the presence of configuration.php)
The cli script does not have this check

When the installation folder is not deleted on an installed site in dev mode, you can still go through the installation.

No you can not. Why is it always such a battle for you to accept what anyoine else says.

// Check if a configuration file already exists.
if (
file_exists(JPATH_CONFIGURATION . '/configuration.php')
&& (filesize(JPATH_CONFIGURATION . '/configuration.php') > 10)
&& !file_exists(JPATH_INSTALLATION . '/index.php')
) {
header('Location: ../index.php');
exit();
}

Because I tried it and installation simply opens up. I did not try what happens when you provided all config options and then click on the install button. Looking at the code, I'd say line 20 is a bullshit condition. You wont run into the situation that the entry point, the index.php of the installation is missing, but the framework.php of the installation is still present. And there is no code to just delete that index.php, as far as I remember.

avatar brianteeman
brianteeman - comment - 28 Jul 2022

Because I tried it and installation simply opens up.

Obviously you need to try it again!!

j4

j4-2

avatar rdeutz
rdeutz - comment - 30 Jul 2022

It's working. Did run into the problem that I had a configuration.php present and didn't understand that the Message "[ERROR] You can still continue the installation if you repair the permissions." will tell me this. I think I would make a hard check on configuration.php and exit as long as it exists.

avatar brianteeman
brianteeman - comment - 30 Jul 2022

@rdeutz Thats exactly what I said before - but of course hannes says it works perfectly for him and that doesnt happen

avatar roland-d
roland-d - comment - 3 Aug 2022

So I also gave this a try and it works well for me. The only thing that got me thinking is this question:

Database type. Supported: mysql, mysqli, pgsql, postgresql [mysqli]:

In the GUI this looks clearer to me:
image

You also notice, I am only presented with the options of adapters that are actually available in my site

avatar brianteeman
brianteeman - comment - 3 Aug 2022

I have tested this item ? unsuccessfully on ec4c946

all the language strings are still wrong


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

avatar brianteeman brianteeman - test_item - 3 Aug 2022 - Tested unsuccessfully
avatar RickR2H
RickR2H - comment - 3 Aug 2022

@Hackwar thanks for creating this awesome feature!
I noticed that the database password can't be empty? Is this now by design?


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

avatar alikon
alikon - comment - 27 Aug 2022

after the latest commits the only open point is this (imho):
#38325 (comment)

based on who will install joomla in this way, i believe they know what they are doing,
surely can be improved, btw,

avatar alikon
alikon - comment - 27 Aug 2022

I have tested this item successfully on ec4c946


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

avatar alikon alikon - test_item - 27 Aug 2022 - Tested successfully
avatar brianteeman
brianteeman - comment - 27 Aug 2022

all the language strings are still wrong

avatar HLeithner
HLeithner - comment - 30 Aug 2022

all the language strings are still wrong

can you clarify this a bit please.

avatar brianteeman
brianteeman - comment - 30 Aug 2022

all the language strings are still wrong

can you clarify this a bit please.

#38325 (comment)

avatar HLeithner
HLeithner - comment - 30 Aug 2022

#38325 (comment)

Thanks, it seems I missed this comment

avatar alikon alikon - alter_testresult - 30 Aug 2022 - alikon: Not tested
avatar alikon alikon - alter_testresult - 30 Aug 2022 - alikon: Not tested
avatar alikon
alikon - comment - 30 Aug 2022

if you install for the 1st time all goes fine
after delete the configuration.php
and install again
image

this not happens in the web install , you can install multiple with same db setteings

avatar Hackwar
Hackwar - comment - 13 Sep 2022

I've been messing around quite a bit with the field names and either we change all the field names in the web installation or we keep the clilabel attribute I introduced here. The web labels are not understandable in the CLI context. For example the label for the database user name is Either a username you created or a username provided by your host. This does not explain what the script is expecting here.

The other possibility would be to load a different language file with different translations and error messages. What do you want me to do here?

avatar HLeithner
HLeithner - comment - 13 Sep 2022

Loading a language string sounds not bad

avatar brianteeman
brianteeman - comment - 13 Sep 2022

My issue with the text in this PR is as I have said from the very beginning thata you are not using the correct terminology

avatar Hackwar
Hackwar - comment - 14 Sep 2022

So... what is the correct terminology when in the web installer the field for the database user name is labeled Either a username you created or a username provided by your host.? If I were to use the terminology of the web installer, nobody would understand that at this point they should provide the database user name.

avatar brianteeman
brianteeman - comment - 14 Sep 2022

That is NOT what I am referring to.

Compare your strings and the core web strings and it will be obvious

avatar joomla-cms-bot joomla-cms-bot - change - 14 Sep 2022
Category Unit Tests Installation Libraries Unit Tests Installation Language & Strings Libraries
avatar Hackwar
Hackwar - comment - 14 Sep 2022

So, I changed this to use a translation file and it is using the same keys for the web as for the CLI installation. However I really don't understand what you are trying to tell me. Looking at the english strings used in the installation, I don't really see the high quality you are talking about. Example from the Login Data screen:

Enter the real name of your Super User.
Set the username for your Super User account.
Set the password for your Super User account.
Enter the email address of the website Super User.

Is it Super User account or just the Super User and is it for your or of the website? And the Database Configuration screen isn't really much better.

avatar Hackwar
Hackwar - comment - 14 Sep 2022

Oh, and I added the same keys with an additional _SHORT at the end for the description of the CLI parameters in the help command.

avatar brianteeman
brianteeman - comment - 14 Sep 2022

In the original pr you had replaced the term super user with administrator

avatar Hackwar
Hackwar - comment - 14 Sep 2022

So, now that this is changed to "Super User", can we merge this then?

avatar alikon
alikon - comment - 14 Sep 2022

can you check this comment #38325 (comment)

avatar Hackwar
Hackwar - comment - 14 Sep 2022

can you check this comment #38325 (comment)

I'm on that one.

avatar brianteeman
brianteeman - comment - 14 Sep 2022

Not at the pc right now. Will retest this afternoon

avatar brianteeman
brianteeman - comment - 14 Sep 2022

If you try to reinstall with the same database and database prefix then you get the following error

image

In the web install you do not get an error and the existing tables are all prefixed bak_

avatar Hackwar Hackwar - change - 14 Sep 2022
Labels Added: Language Change
avatar brianteeman
brianteeman - comment - 14 Sep 2022

(@Hackwar you may receive some email notifications for changes I have deleted)

avatar brianteeman
brianteeman - comment - 14 Sep 2022

try the following command
php installation/joomla.php install -n

expected behaviour

error or warning messages for eaach missing and required field

actual behaviour

it is stuck in a loop generating the first message

image

avatar brianteeman
brianteeman - comment - 14 Sep 2022

Enter incorrect database password

expected behaviour

image

actual behaviour

image

avatar Hackwar
Hackwar - comment - 15 Sep 2022

Enter incorrect database password

expected behaviour

image

actual behaviour

image

I'm not sure what you are expecting. Do you mean that it should only display an error message and not the "Validating DB connection" above that?

avatar brianteeman
brianteeman - comment - 15 Sep 2022

I'm not sure what you are expecting. Do you mean that it should only display an error message and not the "Validating DB connection" above that?

It shouldnt show the line in yellow

avatar Hackwar
Hackwar - comment - 15 Sep 2022

try the following command php installation/joomla.php install -n

expected behaviour

error or warning messages for eaach missing and required field

actual behaviour

it is stuck in a loop generating the first message

image

This should be fixed now.

avatar Hackwar
Hackwar - comment - 15 Sep 2022

If you try to reinstall with the same database and database prefix then you get the following error

image

In the web install you do not get an error and the existing tables are all prefixed bak_

This should be fixed now.

avatar brianteeman
brianteeman - comment - 20 Sep 2022

I really don't understand why you made that last change. What was wrong with the text/description/options in the web installer. From what I can tell this just makes it even worse

avatar Hackwar
Hackwar - comment - 20 Sep 2022

Enter incorrect database password

expected behaviour

image

actual behaviour

image

fixed.

avatar Hackwar
Hackwar - comment - 20 Sep 2022

I really don't understand why you made that last change. What was wrong with the text/description/options in the web installer. From what I can tell this just makes it even worse

I have no idea what you are talking about. These are the strings used in the web installer.

avatar brianteeman
brianteeman - comment - 20 Sep 2022

They are not the same strings or the same options.

The list in the web installer is much more informative esp with regards to PDO

; Database types (allows for a more descriptive label than the internal name)
MYSQL="MySQL (PDO)"
MYSQLI="MySQLi"
ORACLE="Oracle"
PGSQL="PostgreSQL (PDO)"
POSTGRESQL="PostgreSQL"
SQLITE="SQLite"

avatar Hackwar
Hackwar - comment - 20 Sep 2022

We don't support neither Oracle, not PostgreSQL or SQLite. We only support MySQLi, MySQL (PDO) and PostgreSQL (PDO). Those translation strings are simply outdated and need to be removed.

avatar Hackwar
Hackwar - comment - 20 Sep 2022

Joomla 4 only supports those 3 drivers.

avatar brianteeman
brianteeman - comment - 21 Sep 2022

Enter incorrect database password

expected behaviour

image

actual behaviour

image

fixed.

the yellow text has gone but I am getting a partial duplication of the message

[ERROR] Could not connect to the database. Connector returned error message: Could not connect to database: Access
denied for user 'root'@'localhost' (using password: YES)

avatar brianteeman
brianteeman - comment - 21 Sep 2022

Joomla 4 only supports those 3 drivers.

fair enough

avatar Hackwar
Hackwar - comment - 21 Sep 2022

the yellow text has gone but I am getting a partial duplication of the message

[ERROR] Could not connect to the database. Connector returned error message: Could not connect to database: Access
denied for user 'root'@'localhost' (using password: YES)

Yes, however that is expected.

avatar brianteeman
brianteeman - comment - 21 Sep 2022

Why is it now expected that the error message is repeated. It was not before

avatar alikon
alikon - comment - 26 Sep 2022

#38325 (comment)
i confirm is fixed now

avatar Hackwar
Hackwar - comment - 29 Sep 2022

Why is it now expected that the error message is repeated. It was not before

Because one is the error message from the install script, telling us that there was an error connecting to the DB and the second error message is the message from the connector why it failed.

avatar Hackwar
Hackwar - comment - 29 Sep 2022

It would be cool if all the people who did test this so far could renew their tests so that we can finally merge this one. ?

avatar brianteeman
brianteeman - comment - 29 Sep 2022

Why is it now expected that the error message is repeated. It was not before

Because one is the error message from the install script, telling us that there was an error connecting to the DB and the second error message is the message from the connector why it failed.

There is zero reason for it to say Could not connect to the database twice

avatar brianteeman
brianteeman - comment - 29 Sep 2022

I have tested this item ? unsuccessfully on ec4c946


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

avatar brianteeman brianteeman - test_item - 29 Sep 2022 - Tested unsuccessfully
avatar laoneo
laoneo - comment - 30 Sep 2022

Despite the smaller issues I just reported, I see a lot of duplicated code. For example the cli app is not really needed and it should be done through cli/joomla.php.

In general I really love to get a cli installer, but this one needs a bit more polish here.

avatar Hackwar
Hackwar - comment - 30 Sep 2022

I did try to implement this with the existing application, but the original app, since it extends from the CMSApplication class, has huge issues in the CLI context. Additionally, as I wrote above, the installation is a hot mess. The models have lots of side effects and very much differe in behavior. It would be awesome if someone could refactor this to make everything throw proper exceptions, take the configuration as method parameters instead of sometimes reading it from the session, etc. But, again, that exceeds the scope of this PR.

avatar alikon
alikon - comment - 1 Oct 2022

this PR right now is already a big step

yes ? it is

and i will offer to help on the next pr's test etc
so please merge it ?️

avatar alikon
alikon - comment - 1 Oct 2022

I have tested this item successfully on ec4c946


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

avatar alikon alikon - test_item - 1 Oct 2022 - Tested successfully
avatar max123kl
max123kl - comment - 6 Oct 2022

I have tested this item successfully on Prebuilt package

avatar richard67 richard67 - change - 6 Oct 2022
Status Pending Ready to Commit
avatar richard67
richard67 - comment - 6 Oct 2022

RTC


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

avatar brianteeman
brianteeman - comment - 6 Oct 2022

rtc ??

Negative tests dont count?

avatar richard67
richard67 - comment - 6 Oct 2022

@brianteeman I remember from past tests of the web installer that the duplicate message also appeared there, depending on if you use the MySQLi or the PDO driver. One of them is verbose with padding through the real name trot messages from the database and the other one is not. So I think that issue is not caused by this PT but either by one of the drivers or the db client itself. Have you checked that your issue appears only in the CLI installer but not with the web installer, with both of the drivers?

Another thing is that I do not think that this issue should stop this PR of which we both know it is an important base for Hosters to fix their one click installers.

Finally, remembering you you react when someone criticises something on one of your PRs, just closing, then I think you should treat others like you wanna be treated. But that’s not the case. You block other peoples PRs with little things but get mad when the same happens to you. You should maybe think about that.

avatar brianteeman
brianteeman - comment - 6 Oct 2022

if error messages are to be diplayed then they should be useful.

[ERROR] Could not connect to the database. Connector returned error message: Could not connect to database: Access
denied for user 'root'@'localhost' (using password: YES)

===>

[ERROR] Could not connect to the database. Connector returned error message:  Access denied for user 'root'@'localhost' (using password: YES)

or
===>

[ERROR] Could not connect to the database. Access denied for user 'root'@'localhost' (using password: YES)

OT but I close my own pr when they are shown to be incorrect or unwanted. I thought that was the correct thing to do.

avatar richard67
richard67 - comment - 6 Oct 2022

I gotta go sleep because of work tomorrow. I‘ve asked maintainers to check if I am wrong and remove RTC, if so.

avatar laoneo
laoneo - comment - 7 Oct 2022

@Hackwar can you have a look on the double message. Afterwards I guess we are ready then.

avatar Hackwar Hackwar - change - 17 Oct 2022
The description was changed
avatar Hackwar Hackwar - edited - 17 Oct 2022
avatar Hackwar Hackwar - change - 17 Oct 2022
Labels Added: ? Documentation Required
avatar Hackwar
Hackwar - comment - 17 Oct 2022

I removed the double error string. I just want to point out, that that is the error you get in the web installer when the credentials are wrong. So you are requesting different, stricter standards for the CLI installer than for the normal web installer. But whatever. Here you go, there is your fixed translation string. I also sorted the translation strings for the CLI file alphanumerically. Can we please merge this now?

BTW: Dieter Ziller was so kind to help with the documentation. See the link added to the first post in this PR.

avatar obuisard
obuisard - comment - 19 Oct 2022

@Hackwar thank you for documenting the CLI installation process. Great job.

avatar Hackwar Hackwar - change - 21 Oct 2022
Labels Removed: Documentation Required
avatar HLeithner HLeithner - change - 21 Oct 2022
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2022-10-21 14:26:23
Closed_By HLeithner
avatar HLeithner HLeithner - close - 21 Oct 2022
avatar HLeithner HLeithner - merge - 21 Oct 2022
avatar HLeithner
HLeithner - comment - 21 Oct 2022

Thanks

avatar Hackwar
Hackwar - comment - 21 Oct 2022

Thank you!

Add a Comment

Login with GitHub to post a comment