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') }} 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,