User tests: Successful: Unsuccessful:
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.
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.
php installation/joomla.php install
in your installation and check that afterwards Joomla is properly installed.php installation/joomla.php install
with all necessary CLI optionsIf you are using a dev version (checked out the GIT version) the installation folder is preserved, otherwise the folder is deleted.
The CLI installation is documented here: https://docs.joomla.org/J4.x:Joomla_CLI_Installation as well as in installation/INSTALL
.
I'd like to thank Mittwald for supporting this improvement.
Status | New | ⇒ | Pending |
Labels |
Added:
?
PR-4.3-dev
|
Category | ⇒ | Unit Tests Installation Libraries |
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.
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
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
other than these cosmetic issues it appears to work
there isn't a prebuild for 4.3 branch yet ?
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
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.
Ah that one.
Please use the same terminology and field order as in the regular web site install
Especially as the error messages are based on the web install terminology
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.
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
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.
The language you are using is not correct!!
I reordered the fields.
why? What is the reasoning. A lot of thought went into the ordering.
I have tested this item
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.
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
on a 2nd look
the db_password can be empty in the web installer
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
the password of the administrator account is still visible
plus
there is no option to set a db_prefix a random one is generated
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.
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.
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 checkWhen 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.
joomla-cms/installation/includes/framework.php
Lines 16 to 24 in a84ef00
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 checkWhen 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.
joomla-cms/installation/includes/framework.php
Lines 16 to 24 in a84ef00
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.
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.
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:
You also notice, I am only presented with the options of adapters that are actually available in my site
I have tested this item
all the language strings are still wrong
@Hackwar thanks for creating this awesome feature!
I noticed that the database password can't be empty? Is this now by design?
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,
I have tested this item
all the language strings are still wrong
all the language strings are still wrong
can you clarify this a bit please.
all the language strings are still wrong
can you clarify this a bit please.
Thanks, it seems I missed this comment
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?
Loading a language string sounds not bad
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
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.
That is NOT what I am referring to.
Compare your strings and the core web strings and it will be obvious
Category | Unit Tests Installation Libraries | ⇒ | Unit Tests Installation Language & Strings Libraries |
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.
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.
In the original pr you had replaced the term super user with administrator
So, now that this is changed to "Super User", can we merge this then?
can you check this comment #38325 (comment)
can you check this comment #38325 (comment)
I'm on that one.
Not at the pc right now. Will retest this afternoon
Labels |
Added:
Language Change
|
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
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 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.
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"
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.
Joomla 4 only supports those 3 drivers.
Enter incorrect database password
expected behaviour
actual behaviour
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)
Joomla 4 only supports those 3 drivers.
fair enough
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.
Why is it now expected that the error message is repeated. It was not before
#38325 (comment)
i confirm is fixed now
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.
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.
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
I have tested this item
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.
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.
this PR right now is already a big step
yes
and i will offer to help on the next pr's test etc
so please merge it
I have tested this item
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
rtc ??
Negative tests dont count?
@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.
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.
I gotta go sleep because of work tomorrow. I‘ve asked maintainers to check if I am wrong and remove RTC, if so.
Labels |
Added:
?
Documentation Required
|
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.
Labels |
Removed:
Documentation Required
|
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 |
Thanks
Thank you!
excited to try this. would it not make more sense for it to be in the cli folder?