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
30 changes: 14 additions & 16 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,25 @@ jobs:

strategy:
matrix:
php: [ '8.2' ]
php: [ '8.2', '8.3', '8.4' ]
mysql-version: [ '5.7', '8.0', '8.4' ]

services:
mysql:
image: "mysql:${{ matrix.mysql-version }}"
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: mysqlreplication_test
ports:
- 3306/tcp

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Start mysql service
run: |
echo -e "\n[mysqld]\nserver-id=1\nbinlog_format=row\nlog_bin=/var/log/mysql/mysql-bin.log\nbinlog_rows_query_log_events=ON" | sudo tee -a /etc/mysql/my.cnf
sudo /etc/init.d/mysql start
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql -proot
- uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: "${{ matrix.mysql-version }}"
my-cnf: |
server-id=1
binlog_format=row
binlog_rows_query_log_events=ON
log_bin=binlog
root-password: root

- name: set up timezones
run: mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql -proot

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
Expand All @@ -39,7 +37,7 @@ jobs:

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
Expand Down
8 changes: 7 additions & 1 deletion src/MySQLReplication/Repository/MySQLRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,14 @@ public function getVersion(): string

public function getMasterStatus(): MasterStatusDTO
{
$query = 'SHOW MASTER STATUS';

if (str_starts_with($this->getVersion(), '8.4')) {
$query = 'SHOW BINARY LOG STATUS';
}

$data = $this->getConnection()
->fetchAssociative('SHOW MASTER STATUS');
->fetchAssociative($query);
if (empty($data)) {
throw new BinLogException(
MySQLReplicationException::BINLOG_NOT_ENABLED,
Expand Down