From 74d4f571936700bbde2b4889d343f1dad08f4ba1 Mon Sep 17 00:00:00 2001 From: Christoph Grabenstein Date: Wed, 16 Apr 2025 18:08:31 +0200 Subject: [PATCH 1/2] Updating workflow --- .github/workflows/tests.yml | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8d59e50..a29ae61 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 @@ -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') }} From 4e6462c6a76ac714ad9edf3bf12a4fd7c75fd289 Mon Sep 17 00:00:00 2001 From: Christoph Grabenstein Date: Wed, 16 Apr 2025 18:08:45 +0200 Subject: [PATCH 2/2] Add query for MySQL 8.4 --- src/MySQLReplication/Repository/MySQLRepository.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/MySQLReplication/Repository/MySQLRepository.php b/src/MySQLReplication/Repository/MySQLRepository.php index ee7a779..19cfdf6 100644 --- a/src/MySQLReplication/Repository/MySQLRepository.php +++ b/src/MySQLReplication/Repository/MySQLRepository.php @@ -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,