Skip to content
Merged
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
16 changes: 12 additions & 4 deletions src/joomla.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,24 @@ const joomlaCommands = () => {
cy.get('#jform_admin_email').type(config.email)
cy.get('#step2').click()

// Fill database configuration
// Fill database connection settings
let connection = config.db_host
if (config.db_port && config.db_port.trim() !== "") {
// host:port currently (August 2024) only work for MariaDB and MySQL
const isPortSet = config.db_port && config.db_port.trim() !== "";
// If the host is an IPv6 address, not already in square brackets,
// and it's not PostgreSQL without a port number, add square brackets around it.
if (connection.split(':').length > 2 && !connection.includes('[') &&
(isPortSet || (config.db_type !== 'PostgreSQL (PDO)') && (config.db_type !== 'pgsql'))) {
// MariaDB and MySQL require square brackets around IPv6 addresses, even if no port is set
// For PostgreSQL, square brackets are used only if a port number is provided
// (see PR https://github.com/joomla-framework/database/pull/315)
connection = `[${connection}]`;
}
if (isPortSet) {
connection += `:${config.db_port.trim()}`;
}
cy.get('#jform_db_type').select(config.db_type)
cy.get('#jform_db_host').clear().type(connection)
cy.get('#jform_db_user').type(config.db_user)

if (config.db_password) {
cy.get('#jform_db_pass').type(config.db_password)
}
Expand Down