Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ steps:
environment:
JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1
commands:
- bash tests/System/drone-system-run.sh "$(pwd)" cmysql mysqli mysql
- bash tests/System/drone-system-run.sh "$(pwd)" cmysql mysqli mysql 3306

- name: phpmax-system-mysql
depends_on:
Expand All @@ -161,7 +161,7 @@ steps:
environment:
JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1
commands:
- bash tests/System/drone-system-run.sh "$(pwd)" cmysqlmax mysqli mysql
- bash tests/System/drone-system-run.sh "$(pwd)" cmysqlmax mysqli mysql 3306
when:
event:
exclude:
Expand All @@ -180,7 +180,7 @@ steps:
commands:
- echo "This test is disabled because php next is not stable yet"
- exit 1
- bash tests/System/drone-system-run.sh "$(pwd)" cmysqlnext mysqli mysql
- bash tests/System/drone-system-run.sh "$(pwd)" cmysqlnext mysqli mysql 3306
when:
event:
exclude:
Expand All @@ -196,7 +196,7 @@ steps:
environment:
JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1
commands:
- bash tests/System/drone-system-run.sh "$(pwd)" cpostgres pgsql postgres
- bash tests/System/drone-system-run.sh "$(pwd)" cpostgres pgsql postgres 5432
when:
event:
exclude:
Expand All @@ -212,7 +212,7 @@ steps:
environment:
JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1
commands:
- bash tests/System/drone-system-run.sh "$(pwd)" cpostgresmax pgsql postgres
- bash tests/System/drone-system-run.sh "$(pwd)" cpostgresmax pgsql postgres 5432

- name: phpnext-system-postgres
depends_on:
Expand All @@ -227,7 +227,7 @@ steps:
commands:
- echo "This test is disabled because php next is not stable yet"
- exit 1
- bash tests/System/drone-system-run.sh "$(pwd)" cpostgresnext pgsql postgres
- bash tests/System/drone-system-run.sh "$(pwd)" cpostgresnext pgsql postgres 5432
when:
event:
exclude:
Expand Down
7 changes: 6 additions & 1 deletion administrator/components/com_config/forms/application.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,12 @@
required="true"
filter="string"
/>

<field
name="db_port"
type="text"
label="COM_CONFIG_DATABASE_PORT_DESC"
class="form-control"
/>
<field
name="user"
type="text"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ public function save($data)
$options = [
'driver' => $data['dbtype'],
'host' => $data['host'],
'port' => $data['db_port'],
'user' => $data['user'],
'password' => $data['password'],
'database' => $data['db'],
Expand Down
6 changes: 6 additions & 0 deletions installation/forms/setup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@
default="localhost"
required="true"
/>
<field
name="db_port"
type="text"
label="INSTL_DATABASE_PORT_DESC"
class="form-control"
/>
<field
name="db_user"
type="text"
Expand Down
3 changes: 2 additions & 1 deletion installation/src/Helper/DatabaseHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ abstract class DatabaseHelper
*
* @since 1.6
*/
public static function getDbo($driver, $host, $user, $password, $database, $prefix, $select = true, array $ssl = [])
public static function getDbo($driver, $host, $user, $password, $database, $prefix, $select = true, array $ssl = [], $port = 3306)
{
static $db;

Expand All @@ -81,6 +81,7 @@ public static function getDbo($driver, $host, $user, $password, $database, $pref
$options = [
'driver' => $driver,
'host' => $host,
'port' => $port,
'user' => $user,
'password' => $password,
'database' => $database,
Expand Down
4 changes: 3 additions & 1 deletion installation/src/Model/ConfigurationModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public function setup($options)
$options->db_name,
$options->db_prefix,
true,
DatabaseHelper::getEncryptionSettings($options)
DatabaseHelper::getEncryptionSettings($options),
$options->db_port,
);
} catch (\RuntimeException $e) {
Factory::getApplication()->enqueueMessage(Text::sprintf('INSTL_ERROR_CONNECT_DB', $e->getMessage()), 'error');
Expand Down Expand Up @@ -380,6 +381,7 @@ public function createConfiguration($options)
// Database settings.
$registry->set('dbtype', $options->db_type);
$registry->set('host', $options->db_host);
$registry->set('port', $options->db_port);
$registry->set('user', $options->db_user);
$registry->set('password', $options->db_pass_plain);
$registry->set('db', $options->db_name);
Expand Down
3 changes: 2 additions & 1 deletion installation/src/Model/DatabaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ public function initialise(array $options, bool $select = true)
$options->db_name,
$options->db_prefix,
$select,
DatabaseHelper::getEncryptionSettings($options)
DatabaseHelper::getEncryptionSettings($options),
$options->db_port,
);
} catch (\RuntimeException $e) {
Factory::getApplication()->enqueueMessage(Text::sprintf('INSTL_DATABASE_COULD_NOT_CONNECT', $e->getMessage()), 'error');
Expand Down
3 changes: 2 additions & 1 deletion installation/src/Model/SetupModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ public function validateDbConnection(array $options)
$options->db_name,
$options->db_prefix,
false,
DatabaseHelper::getEncryptionSettings($options)
DatabaseHelper::getEncryptionSettings($options),
$options->db_port,
);

$db->connect();
Expand Down
3 changes: 3 additions & 0 deletions installation/tmpl/setup/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@
<div class="mb-3">
<?php echo $this->form->renderField('db_host'); ?>
</div>
<div class="mb-3">
<?php echo $this->form->renderField('db_port'); ?>
</div>
<div class="mb-3">
<?php echo $this->form->renderField('db_user'); ?>
</div>
Expand Down
1 change: 1 addition & 0 deletions libraries/src/Service/Provider/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ function (Container $container) {
$options = [
'driver' => $dbtype,
'host' => $conf->get('host'),
'port' => $conf->get('port'),
'user' => $conf->get('user'),
'password' => $conf->get('password'),
'database' => $conf->get('db'),
Expand Down
3 changes: 2 additions & 1 deletion tests/System/drone-system-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ JOOMLA_BASE=$1
TEST_GROUP=$2
DB_ENGINE=$3
DB_HOST=$4
DB_PORT=$5

echo "[RUNNER] Prepare test environment"

Expand All @@ -23,4 +24,4 @@ apache2ctl -D FOREGROUND &
echo "[RUNNER] Run cypress tests"
chmod +rwx /root

npx cypress run --browser=firefox --e2e --env cmsPath=/tests/www/$TEST_GROUP,db_type=$DB_ENGINE,db_host=$DB_HOST,db_password=joomla_ut,db_prefix="${TEST_GROUP}_" --config baseUrl=http://localhost/$TEST_GROUP,screenshotsFolder=$JOOMLA_BASE/tests/System/output/screenshots
npx cypress run --browser=firefox --e2e --env cmsPath=/tests/www/$TEST_GROUP,db_type=$DB_ENGINE,db_host=$DB_HOST,db_port=$DB_PORT,db_password=joomla_ut,db_prefix="${TEST_GROUP}_" --config baseUrl=http://localhost/$TEST_GROUP,screenshotsFolder=$JOOMLA_BASE/tests/System/output/screenshots
3 changes: 3 additions & 0 deletions tests/System/integration/install/Installation.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ describe('Install Joomla', () => {
db_password: Cypress.env('db_password'),
db_name: Cypress.env('db_name'),
db_prefix: Cypress.env('db_prefix'),
db_port: Cypress.env('db_port'),
};

// If exists, delete PHP configuration file to force a new installation
cy.task('deleteRelativePath', 'configuration.php');
cy.installJoomla(config);

// set the db port
cy.config_setParameter('port', Cypress.env('db_port'));
cy.doAdministratorLogin(config.username, config.password, false);
cy.cancelTour();
cy.disableStatistics();
Expand Down