Skip to content
Merged
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
34 changes: 14 additions & 20 deletions .github/workflows/mage-os_nightly_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,26 @@ jobs:
--health-timeout=5s
--health-retries=10

mariadb:
image: "mariadb:10.6"
env:
MARIADB_ROOT_PASSWORD: root
MARIADB_DATABASE: magento
ports:
- 3306 # Standard MariaDB/MySQL port
# Options remain largely the same, health check uses mysqladmin (compatible)
options: >-
--health-cmd="mariadb-admin ping -uroot -proot || exit 1"
--health-interval=10s
--health-timeout=5s
--health-retries=10

steps:
- name: Checkout develop branch
uses: actions/[email protected]
with:
ref: develop

- uses: shogo82148/actions-setup-mysql@v1
with:
distribution: "mariadb"
mysql-version: "11.4"
auto-start: "true"
root-password: "root"

- name: Check MariaDB version
run: "mariadb -uroot -proot -e 'SELECT version();'"

- name: List installed MySQL/MariaDB tools
run: |
mariadb --version || true
mariadb-dump --version || true
mysql --version || true
mysqldump --version || true

- name: Create Magento database
run: "mariadb -uroot -proot -e 'CREATE DATABASE magento;'"

- name: Linux Setup
run: ./.github/workflows/linux-setup.sh

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ RECENT CHANGES
- Imp: feat(dev:hyva:build): Add check for Hyvä theme in dev:hyva:build command (by Christian Münch)
- Fix: better TTY handling in proxy command (PR #1667, issue #1422, by Christian Münch)
- Fix: PHP 8.4 compatibility updates (PR #1655, issue #1654, by Christian Münch)
- Fix: Port handling in database helper (by Christian Münch)
- Build: CI release workflow enhancements (PR #1657, issue #1657, by Christian Münch)

8.1.1
Expand Down
21 changes: 16 additions & 5 deletions src/N98/Util/Console/Helper/DatabaseHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,14 @@ public function detectDbSettings(?OutputInterface $output)
if (strpos($this->dbSettings['host'], '/') !== false) {
$this->dbSettings['unix_socket'] = $this->dbSettings['host'];
unset($this->dbSettings['host']);
} elseif (strpos($this->dbSettings['host'], ':') !== false) {
list($this->dbSettings['host'], $this->dbSettings['port']) = explode(':', $this->dbSettings['host']);
} elseif (strpos($this->dbSettings['host'], ':') !== false
&& substr_count($this->dbSettings['host'], ':') === 1) {
// Only split if not IPv6 (which has multiple colons)
list($host, $port) = explode(':', $this->dbSettings['host'], 2);
$this->dbSettings['host'] = $host;
if (is_numeric($port)) {
$this->dbSettings['port'] = (int)$port;
}
}
}

Expand Down Expand Up @@ -195,8 +201,13 @@ public function getConnection(?OutputInterface $output = null, bool $reconnect =
if (strpos($this->dbSettings['host'], '/') !== false) {
$this->dbSettings['unix_socket'] = $this->dbSettings['host'];
unset($this->dbSettings['host']);
} elseif (strpos($this->dbSettings['host'], ':') !== false) {
list($this->dbSettings['host'], $this->dbSettings['port']) = explode(':', $this->dbSettings['host']);
} elseif (strpos($this->dbSettings['host'], ':') !== false && substr_count($this->dbSettings['host'], ':') === 1) {
// Only split if not IPv6 (which has multiple colons)
list($host, $port) = explode(':', $this->dbSettings['host'], 2);
$this->dbSettings['host'] = $host;
if (is_numeric($port)) {
$this->dbSettings['port'] = (int)$port;
}
}
}

Expand Down Expand Up @@ -440,7 +451,7 @@ public function getMysqlClientToolConnectionString()
. ' '
. '-u' . escapeshellarg($this->dbSettings['username'])
. ' '
. (isset($this->dbSettings['port'])
. (isset($this->dbSettings['port']) && is_numeric($this->dbSettings['port']) && (int)$this->dbSettings['port'] > 0
? '-P' . escapeshellarg($this->dbSettings['port']) . ' ' : '')
. (strlen($this->dbSettings['password'])
? '--password=' . escapeshellarg($this->dbSettings['password']) . ' ' : '')
Expand Down
23 changes: 12 additions & 11 deletions tests/bats/functional_magerun_commands.bats
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,18 @@ function cleanup_files_in_magento() {
assert_output --partial "innodb_buffer_pool_size"
}


# ============================================
# Command: db:query
# ============================================

@test "Command: db:query --format=csv" {
run $BIN "db:query" --format=csv "SELECT 1 AS foo, 2 AS bar"
assert_output --partial '"foo","bar"'
assert_output --partial '"1","2"'
assert [ "$status" -eq 0 ]
}

# ============================================
# Command: design:demo-notice
# ============================================
Expand All @@ -549,17 +561,6 @@ function cleanup_files_in_magento() {
# assert_output --partial "di"
#}

# ============================================
# Command: db:query
# ============================================

@test "Command: db:query --format=csv" {
run $BIN "db:query" --format=csv "SELECT 1 AS foo, 2 AS bar"
assert_output --partial '"foo","bar"'
assert_output --partial '"1","2"'
assert [ "$status" -eq 0 ]
}

# ============================================
# Command: dev:module:create
# ============================================
Expand Down