Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.3] Add a CLI installation for Joomla #38325

Merged
merged 79 commits into from
Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
09da490
Initial code for a CLI installation
Hackwar Jul 4, 2022
c76c8b9
Merge branch '4.2-dev' of https://github.com/joomla/joomla-cms into 4…
Hackwar Jul 15, 2022
cbef259
First PoC
Hackwar Jul 16, 2022
cdd55e1
Lots of cleanup
Hackwar Jul 16, 2022
0aea315
Finalising CLI installer
Hackwar Jul 25, 2022
2f07fa6
Deleting install folder after installation
Hackwar Jul 25, 2022
3ca0c8d
Merge branch '4.3-dev' into 4.2-installer-cli
Hackwar Jul 25, 2022
dafca02
Codestyle
Hackwar Jul 25, 2022
c186f89
Merge branch '4.2-installer-cli' of github.com:Hackwar/joomla-cms int…
Hackwar Jul 25, 2022
4be9398
Fixing path of API test install
Hackwar Jul 25, 2022
bb18048
Update installation/INSTALL
Hackwar Jul 25, 2022
82f1a54
Codestyle
Hackwar Jul 25, 2022
bbd555a
Merge branch '4.2-installer-cli' of github.com:Hackwar/joomla-cms int…
Hackwar Jul 25, 2022
722087b
Docblocks
Hackwar Jul 25, 2022
cceccf8
Wording
Hackwar Jul 25, 2022
d601438
Fixing db prefix for API tests
Hackwar Jul 25, 2022
59a72e2
Fixing Postgres API tests
Hackwar Jul 25, 2022
e6751fd
Further fixes to API tests
Hackwar Jul 25, 2022
91171a5
Some cleanup
Hackwar Jul 25, 2022
c3ec23e
Fixing API tests one last time
Hackwar Jul 25, 2022
b63f680
Docblock formatting
Hackwar Jul 26, 2022
ed8dd9a
Resorting fields
Hackwar Jul 26, 2022
6ca4269
Improving progress indicator messages
Hackwar Jul 26, 2022
4812698
Merge branch '4.3-dev' of https://github.com/joomla/joomla-cms into 4…
Hackwar Jul 27, 2022
676489b
Disable remote DB check for CLI installation
Hackwar Jul 27, 2022
9197416
Fixing check
Hackwar Jul 27, 2022
d06cfb9
Introducing _JCLI_INSTALLATION constant for DB check
Hackwar Jul 27, 2022
69987f4
Hiding password entries on CLI
Hackwar Jul 28, 2022
c13c614
hide admin psw
alikon Jul 28, 2022
ec4c946
Merge pull request #54 from alikon/patch-7
Hackwar Jul 28, 2022
93b5915
show db_prefix
alikon Jul 30, 2022
fc95af6
Merge branch '4.3-dev' of https://github.com/joomla/joomla-cms into 4…
Hackwar Aug 26, 2022
add2927
Merge branch '4.2-installer-cli' of github.com:Hackwar/joomla-cms int…
Hackwar Aug 26, 2022
305e413
Adding check for configuration.php present
Hackwar Aug 26, 2022
9f03081
Allowing for empty db password
Hackwar Aug 26, 2022
772139f
Deleting installation folder only when not in dev mode
Hackwar Aug 26, 2022
b13cd97
Merge pull request #55 from alikon/patch-6
Hackwar Aug 26, 2022
b4b6fe8
Codestyle
Hackwar Aug 26, 2022
afc2d5f
Merge branch '4.2-installer-cli' of github.com:Hackwar/joomla-cms int…
Hackwar Aug 26, 2022
69e6d8e
Merge branch '4.3-dev' of https://github.com/joomla/joomla-cms into 4…
Hackwar Sep 11, 2022
7ab2f8f
Merge branch '4.3-dev' into 4.2-installer-cli
Hackwar Sep 11, 2022
4fca6da
Converting strings to ini file
Hackwar Sep 14, 2022
9f190b2
Update installation/language/en-GB/joomla.cli.ini
Hackwar Sep 14, 2022
1d7068e
Update installation/src/Console/InstallCommand.php
Hackwar Sep 14, 2022
ead6292
Update installation/src/Console/InstallCommand.php
Hackwar Sep 14, 2022
289aae1
Update installation/src/Console/InstallCommand.php
Hackwar Sep 14, 2022
bcc4ddb
Update installation/src/Console/InstallCommand.php
Hackwar Sep 14, 2022
c95555a
Update installation/src/Console/InstallCommand.php
Hackwar Sep 14, 2022
66877a1
Update installation/language/en-GB/joomla.cli.ini
Hackwar Sep 14, 2022
006f4dc
Update installation/language/en-GB/joomla.cli.ini
Hackwar Sep 14, 2022
7e86e54
Update installation/language/en-GB/joomla.cli.ini
Hackwar Sep 15, 2022
8a439b9
Update installation/language/en-GB/joomla.cli.ini
Hackwar Sep 15, 2022
af3f8ad
Update installation/language/en-GB/joomla.cli.ini
Hackwar Sep 15, 2022
6eb3d8b
Update installation/language/en-GB/joomla.cli.ini
Hackwar Sep 15, 2022
88c3e85
Update installation/INSTALL
Hackwar Sep 15, 2022
d99b156
Further bugfixes
Hackwar Sep 15, 2022
bc0e02f
Merge branch '4.3-dev' of https://github.com/joomla/joomla-cms into 4…
Hackwar Sep 20, 2022
505a1df
Cleaning up available RDBMS options
Hackwar Sep 20, 2022
fe07acf
Catching error when connecting to database
Hackwar Sep 20, 2022
4b248a5
Removing false db type
Hackwar Sep 20, 2022
5f32b6c
Merge branch '4.3-dev' into 4.2-installer-cli
Hackwar Sep 29, 2022
e14e2dd
Fixing case of attribute
Hackwar Sep 30, 2022
e473439
Removing unnecessary methods from CliInstallationApplication
Hackwar Sep 30, 2022
596b1c6
Fixing string
Hackwar Sep 30, 2022
99d050e
Merge branch '4.3-dev' of https://github.com/joomla/joomla-cms into 4…
Hackwar Oct 6, 2022
5075637
Merge branch '4.3-dev' of https://github.com/joomla/joomla-cms into 4…
Hackwar Oct 17, 2022
9e2990e
Sorting translation strings for CLI and adding shortened error message
Hackwar Oct 17, 2022
a5811d3
Fixing docblocks and use statement
Hackwar Oct 17, 2022
164dc71
Merge branch '4.3-dev' of https://github.com/joomla/joomla-cms into 4…
Hackwar Oct 21, 2022
cf03d4a
Merge branch '4.3-dev' of https://github.com/joomla/joomla-cms into 4…
Hackwar Oct 21, 2022
1d9d124
Adding Allons suggestions
Hackwar Oct 21, 2022
e72dcd7
Fixing use statements
Hackwar Oct 21, 2022
a134c65
Using language object from app
Hackwar Oct 21, 2022
9e474b4
Remove unnecessary method
Hackwar Oct 21, 2022
c06bec3
Fixing language object
Hackwar Oct 21, 2022
a944c60
Merge branch '4.3-dev' into 4.2-installer-cli
laoneo Oct 21, 2022
b79b8ed
Removing . at the end of sentences since they are followed by a : anyway
Hackwar Oct 21, 2022
0831d22
Use - instead of _ in the parameters
Hackwar Oct 21, 2022
a8c16b6
Fixing api tests
Hackwar Oct 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ steps:
environment:
JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1
commands:
- bash tests/Codeception/drone-api-run.sh "$(pwd)" mysql
- bash tests/Codeception/drone-api-run.sh "$(pwd)" mysql mysqli mysql jos_

- name: phpmax-api-mysql
depends_on:
Expand All @@ -226,7 +226,7 @@ steps:
environment:
JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1
commands:
- bash tests/Codeception/drone-api-run.sh "$(pwd)" mysqlphpmax
- bash tests/Codeception/drone-api-run.sh "$(pwd)" mysqlphpmax mysqli mysql phpmax_

# - name: phpnext-api-mysql
# depends_on:
Expand All @@ -236,7 +236,7 @@ steps:
# environment:
# JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1
# commands:
# - bash tests/Codeception/drone-api-run.sh "$(pwd)" mysqlphpnext
# - bash tests/Codeception/drone-api-run.sh "$(pwd)" mysqlphpnext mysqli mysql8 phpmax_

- name: phpmin-api-postgres
depends_on:
Expand All @@ -245,7 +245,7 @@ steps:
environment:
JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1
commands:
- bash tests/Codeception/drone-api-run.sh "$(pwd)" postgres
- bash tests/Codeception/drone-api-run.sh "$(pwd)" postgres pgsql postgres jos_

- name: phpmax-api-postgres
depends_on:
Expand All @@ -254,7 +254,7 @@ steps:
environment:
JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1
commands:
- bash tests/Codeception/drone-api-run.sh "$(pwd)" postgresphpmax
- bash tests/Codeception/drone-api-run.sh "$(pwd)" postgresphpmax pgsql postgres phpmax_

# - name: phpnext-api-postgres
# depends_on:
Expand All @@ -264,7 +264,7 @@ steps:
# environment:
# JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1
# commands:
# - bash tests/Codeception/drone-api-run.sh "$(pwd)" postgresphpnext
# - bash tests/Codeception/drone-api-run.sh "$(pwd)" postgresphpnext pgsql postgres

- name: phpmin-system-mysql
depends_on:
Expand Down Expand Up @@ -524,6 +524,6 @@ trigger:

---
kind: signature
hmac: f496f213481b3afcec73da651fc838af21f76950954daac599e665ceb382cc2d
hmac: 35f71c2c3f977f0da835b27f18cea8f07419c3dd14aae4bc8da11fdb624983c5

...
27 changes: 19 additions & 8 deletions installation/INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,31 @@ INSTALLATION

and then enter 'exit' or 'quit' to exit MySQL.

3. WEB INSTALLER
3. INSTALLATION
The main method of installation is via the web browser. You can start that
installation by simply pointing your web browser to http://www.example.org
where the Joomla! web based installer will guide you through the rest of
the installation.

An alternative method of installation is from the command line. On the command line of your
server, in the root folder of Joomla, you can run the following command

php installation/joomla.php install

You will be guided through the rest of the installation and ou can get further help by running

php installation/joomla.php help install

Finally point your web browser to http://www.example.org where the Joomla! web
based installer will guide you through the rest of the installation.

4. CONFIGURE Joomla

You can now launch your browser and point it to your Joomla! site eg
You can now launch your browser and point it to your Joomla! site eg

http://www.example.org -> Main Site
http://www.example.org/administrator -> Admin
http://www.example.org -> Main Site
http://www.example.org/administrator -> Admin

You can log into Admin using the username and password that you chose
during the web based install.
You can log into Admin using the username and password that you chose
during the install.


Joomla! ADMINISTRATION
Expand Down
18 changes: 9 additions & 9 deletions installation/forms/setup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@
class="form-control"
required="true"
/>
<field
name="admin_email"
type="email"
label="INSTL_ADMIN_EMAIL_DESC"
class="form-control"
validate="email"
required="true"
/>
<field
name="admin_user"
type="text"
Expand Down Expand Up @@ -53,12 +45,20 @@
force="on"
filter="raw"
/>
<field
name="admin_email"
type="email"
label="INSTL_ADMIN_EMAIL_DESC"
class="form-control"
validate="email"
required="true"
/>
<field
name="db_type"
type="databaseconnection"
label="INSTL_DATABASE_TYPE_DESC"
class="form-select"
supported="mysql,mysqli,pgsql,postgresql"
supported="mysql,mysqli,pgsql"
required="true"
default="mysqli"
filter="string"
Expand Down
63 changes: 63 additions & 0 deletions installation/includes/cli.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php

/**
* @package Joomla.Installation
* @subpackage Application
*
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

// Define the base path and require the other defines
define('JPATH_BASE', dirname(__DIR__));

require_once __DIR__ . '/defines.php';

// Check for presence of vendor dependencies not included in the git repository
if (!file_exists(JPATH_LIBRARIES . '/vendor/autoload.php') || !is_dir(JPATH_ROOT . '/media/vendor')) {
echo 'It looks like you are trying to run Joomla! from our git repository.' . PHP_EOL;
echo 'To do so requires you complete a couple of extra steps first.' . PHP_EOL;
echo 'Please see https://docs.joomla.org/Special:MyLanguage/J4.x:Setting_Up_Your_Local_Environment for further details.' . PHP_EOL;

exit;
}

// Get the framework.
require_once __DIR__ . '/framework.php';

// Check if the default log directory can be written to, add a logger for errors to use it
if (is_writable(JPATH_ADMINISTRATOR . '/logs')) {
\Joomla\CMS\Log\Log::addLogger(
[
'format' => '{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}',
'text_file' => 'error.php'
],
\Joomla\CMS\Log\Log::ALL,
['error']
);
}

// Register the Installation application
JLoader::registerNamespace('Joomla\\CMS\\Installation', JPATH_INSTALLATION . '/src', false, false);

// Get the dependency injection container
$container = \Joomla\CMS\Factory::getContainer();
$container->registerServiceProvider(new \Joomla\CMS\Installation\Service\Provider\Application());

/*
* Alias the session service keys to the CLI session service as that is the primary session backend for this application
*
* In addition to aliasing "common" service keys, we also create aliases for the PHP classes to ensure autowiring objects
* is supported. This includes aliases for aliased class names, and the keys for aliased class names should be considered
* deprecated to be removed when the class name alias is removed as well.
*/
$container->alias('session', 'session.cli')
->alias('JSession', 'session.cli')
->alias(\Joomla\CMS\Session\Session::class, 'session.cli')
->alias(\Joomla\Session\Session::class, 'session.cli')
->alias(\Joomla\Session\SessionInterface::class, 'session.cli');

// Instantiate and execute the application
$container->get(\Joomla\CMS\Installation\Application\CliInstallationApplication::class)->execute();
39 changes: 39 additions & 0 deletions installation/joomla.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

/**
* @package Joomla.Installation
*
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

/**
* NOTE: This file should remain compatible with PHP 5.2 to allow us to run our PHP minimum check and show a friendly error message
*/

/**
* Define the application's minimum supported PHP version as a constant so it can be referenced within the application.
*/
define('JOOMLA_MINIMUM_PHP', '7.2.5');

if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<')) {
echo 'Sorry, your PHP version is not supported.' . PHP_EOL;
echo 'Your command line php needs to be version ' . JOOMLA_MINIMUM_PHP . ' or newer to run the Joomla! CLI Tools' . PHP_EOL;
echo 'The version of PHP currently running this code, at the command line, is PHP version ' . PHP_VERSION . '.' . PHP_EOL;
echo 'Please note, the version of PHP running your commands here, may be different to the version that is used by ';
echo 'your web server to run the Joomla! Web Application' . PHP_EOL;

exit;
}

/**
* Constant that is checked in included files to prevent direct access.
* define() is used rather than "const" to not error for PHP 5.2 and lower
*/
define('_JEXEC', 1);

// Constant to identify the CLI installation
define('_JCLI_INSTALLATION', 1);

// Run the application - All executable code should be triggered through this file
require_once dirname(__FILE__) . '/includes/cli.php';
35 changes: 35 additions & 0 deletions installation/language/en-GB/joomla.cli.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
INSTL_ADMIN_EMAIL_DESC="Enter the email address of the website Super User"
INSTL_ADMIN_EMAIL_DESC_SHORT="Email address of the website's Super User account"
INSTL_ADMIN_PASSWORD_DESC="Set the password for your Super User account"
INSTL_ADMIN_PASSWORD_DESC_SHORT="Password of your Super User account"
INSTL_ADMIN_USERNAME_DESC="Set the username for your Super User account"
INSTL_ADMIN_USERNAME_DESC_SHORT="Username of your Super User account"
INSTL_ADMIN_USER_DESC="Enter the real name of your Super User"
INSTL_ADMIN_USER_DESC_SHORT="Real name of the Super User account"
INSTL_DATABASE_COULD_NOT_CONNECT="%s"
INSTL_DATABASE_ENCRYPTION_CA_LABEL="Path to CA file to verify encryption against"
INSTL_DATABASE_ENCRYPTION_CA_LABEL_SHORT="Path to CA file to verify encryption against"
INSTL_DATABASE_ENCRYPTION_CERT_LABEL="Path to the SSL certificate for the database connection. Requires encryption to be set to 2"
INSTL_DATABASE_ENCRYPTION_CERT_LABEL_SHORT="Path to the SSL certificate for the database connection. Requires encryption to be set to 2"
INSTL_DATABASE_ENCRYPTION_CIPHER_LABEL="Supported Cipher Suite (optional)"
INSTL_DATABASE_ENCRYPTION_CIPHER_LABEL_SHORT="Supported Cipher Suite (optional)"
INSTL_DATABASE_ENCRYPTION_KEY_LABEL="SSL key for the database connection. Requires encryption to be set to 2"
INSTL_DATABASE_ENCRYPTION_KEY_LABEL_SHORT="SSL key for the database connection. Requires encryption to be set to 2"
INSTL_DATABASE_ENCRYPTION_MODE_LABEL="Encryption for the database connection. Values: 0=None, 1=One way, 2=Two way"
INSTL_DATABASE_ENCRYPTION_MODE_LABEL="Encryption for the database connection. Values: 0=None, 1=One way, 2=Two way"
INSTL_DATABASE_ENCRYPTION_VERIFY_SERVER_CERT_LABEL="Verify SSL certificate for database connection. Values: 0=No, 1=Yes. Requires encryption to be set to 1 or 2"
INSTL_DATABASE_ENCRYPTION_VERIFY_SERVER_CERT_LABEL_SHORT="Verify SSL certificate for database connection. Values: 0=No, 1=Yes. Requires encryption to be set to 1 or 2"
INSTL_DATABASE_HOST_DESC="Database host"
INSTL_DATABASE_HOST_DESC_SHORT="Database host"
INSTL_DATABASE_NAME_DESC="Database name"
INSTL_DATABASE_NAME_DESC_SHORT="Database name"
INSTL_DATABASE_PASSWORD_DESC="Database password"
INSTL_DATABASE_PASSWORD_DESC_SHORT="Database password"
INSTL_DATABASE_PREFIX_DESC="Prefix for the database tables"
INSTL_DATABASE_PREFIX_DESC_SHORT="Prefix for the database tables"
INSTL_DATABASE_TYPE_DESC="Database type. Supported: mysql, mysqli, pgsql"
INSTL_DATABASE_TYPE_DESC_SHORT="Database type. Supported by Joomla: mysql (=MySQL (PDO)), mysqli (=MySQLi), pgsql (=PostgreSQL (PDO))"
INSTL_DATABASE_USER_DESC="Database username"
INSTL_DATABASE_USER_DESC_SHORT="Database username"
INSTL_SITE_NAME_DESC="Enter the name of your Joomla site"
INSTL_SITE_NAME_DESC_SHORT="Name of the website"
Loading