Skip to content

Commit bff9ed7

Browse files
Merge pull request #116 from mirko-pagliai/develop
Develop
2 parents 840fd2d + 8fd6de8 commit bff9ed7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2044
-712
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
php-version: ['8.1', '8.2', '8.3']
15+
php-version: ['8.1', '8.2', '8.3', '8.4']
1616
db-type: [sqlite, mysql, pgsql]
1717
prefer-lowest: ['']
1818
exclude:
@@ -30,6 +30,9 @@ jobs:
3030
- php-version: '8.3'
3131
db-type: 'mysql'
3232
prefer-lowest: 'prefer-lowest'
33+
- php-version: '8.4'
34+
db-type: 'mysql'
35+
prefer-lowest: 'prefer-lowest'
3336

3437
steps:
3538
- name: Setup MySQL 8.0

CHANGELOG.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,30 @@
11
# 2.x branch
22
## 2.13 branch
33
### 2.13.4
4+
* fixed [bug #119](https://github.com/mirko-pagliai/cakephp-database-backup/issues/119): `BackupManager` ignored the
5+
timezone of backup files, and consequently also `IndexCommand`;
6+
* fixed [bug #111](https://github.com/mirko-pagliai/cakephp-database-backup/issues/111): for Mysql it first looks for
7+
`mariadb` and `mariadb-dump` executables, otherwise `mysql` and `mysqldump` executables;
8+
* all classes, methods and code related to sending backups via email are now deprecated. So, the `BackupManager::send()`
9+
method (and, consequently, also the internal `BackupManager::getEmailInstance()` method), the `BackupExport::send()`
10+
method, the `SendCommand` class and the `send` option for the `ExportCommand` are deprecated. All of these will be
11+
removed in a later release. No replacement is provided.
12+
* setting the `DatabaseBackup.mailSender` value of the configuration is deprecated (bootstrap checks that the value
13+
has not been set by the user);
14+
* the `DeleteAllCommand` is deprecated. Will be removed in a future release;
15+
* added tests for php 8.4;
16+
* all chainable methods of `BackupExport` and `BackupImport` classes now have the typehint for returning self. Updated
17+
descriptions;
18+
* updated `phpunit` to `^10.5.5 || ^11.1.3`;
19+
* updated `psalm` to `6.x`;
20+
* uses `cakedc/cakephp-phpstan`;
21+
* the old `FrozenTime` classes have been replaced with `DateTime` (which it was an alias for);
22+
* extensive revision of descriptions and tags of all classes and methods;
23+
* removed some errors related to phpcs, phpstan and psalm, previously silenced;
424
* the `README` file has been updated for compatibility with older versions of CakePHP and PHP (branches have been
5-
removed and older versions are available as tags).
25+
removed and older versions are available as tags);
26+
* overall updated `README` file, updated links to CakePHP documentation. Some information has been moved from the
27+
`README` file to the (new) [Common issues](https://github.com/mirko-pagliai/cakephp-database-backup/wiki/Common-issues) wiki page.
628

729
### 2.13.3
830
* added `--reverse` option for the `IndexCommand` ([issue #96](https://github.com/mirko-pagliai/cakephp-database-backup/issues/96));

README.md

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.txt)
44
[![CI](https://github.com/mirko-pagliai/cakephp-database-backup/actions/workflows/ci.yml/badge.svg)](https://github.com/mirko-pagliai/cakephp-database-backup/actions/workflows/ci.yml)
5-
[![codecov](https://codecov.io/gh/mirko-pagliai/cakephp-database-backup/branch/master/graph/badge.svg)](https://codecov.io/gh/mirko-pagliai/cakephp-database-backup)
6-
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/cd12284c1047431c8149e09fa56536bf)](https://www.codacy.com/gh/mirko-pagliai/cakephp-database-backup/dashboard?utm_source=github.com&utm_medium=referral&utm_content=mirko-pagliai/cakephp-database-backup&utm_campaign=Badge_Grade)
5+
[![codecov](https://codecov.io/gh/mirko-pagliai/cakephp-database-backup/graph/badge.svg?token=nkaJk4nvus)](https://codecov.io/gh/mirko-pagliai/cakephp-database-backup)
6+
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/cd12284c1047431c8149e09fa56536bf)](https://app.codacy.com/gh/mirko-pagliai/cakephp-database-backup/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
77
[![CodeFactor](https://www.codefactor.io/repository/github/mirko-pagliai/cakephp-database-backup/badge)](https://www.codefactor.io/repository/github/mirko-pagliai/cakephp-database-backup)
88

99
*DatabaseBackup* is a CakePHP plugin to export, import and manage database backups.
@@ -15,17 +15,11 @@ even a coffee is enough! Thank you.
1515

1616
[![Make a donation](https://www.paypalobjects.com/webstatic/mktg/logo-center/logo_paypal_carte.jpg)](//paypal.me/mirkopagliai)
1717

18-
* [Requirements](#requirements)
19-
* [Installation](#installation)
20-
+ [Installation on older CakePHP and PHP versions](#installation-on-older-cakephp-and-php-versions)
21-
* [Configuration](#configuration)
22-
* [How to use](#how-to-use)
23-
* [Testing](#testing)
24-
* [Versioning](#versioning)
25-
2618
## Requirements
19+
2720
*DatabaseBackup* requires:
28-
* `mysql` and `mysqldump` for *MySql* databases;
21+
22+
* `mariadb` and `mariadb-dump` for *MySql* databases (previously `mysql` and `mysqldump`);
2923
* `pg_dump` and `pg_restore` for *Postgres* databases;
3024
* `sqlite3` for *Sqlite* databases.
3125

@@ -34,19 +28,16 @@ also required.
3428

3529
The installation of these binaries may vary depending on your operating system.
3630

37-
Please forward, remember that the database user must have the correct
38-
permissions (for example, for `mysql` the user must have the `LOCK TABLES`
39-
permission).
40-
4131
## Installation
32+
4233
You can install the plugin via composer:
4334

4435
```bash
4536
$ composer require --prefer-dist mirko-pagliai/cakephp-database-backup
4637
```
4738

4839
Then you have to load the plugin. For more information on how to load the plugin,
49-
please refer to the [Cookbook](//book.cakephp.org/4.0/en/plugins.html#loading-a-plugin).
40+
please refer to the [Cookbook](https://book.cakephp.org/5/en/plugins.html#loading-a-plugin).
5041

5142
Simply, you can execute the shell command to enable the plugin:
5243
```bash
@@ -66,7 +57,7 @@ If you want to use a different directory, read the [Configuration](#configuratio
6657
### Installation on older CakePHP and PHP versions
6758

6859
Compared to the current installation requirements, some tags are provided for those using older versions of CakePHP and
69-
PHP (until February 7, 2025, they were available as branches, now only as tags):
60+
PHP (*until February 7, 2025, they were available as branches, now only as tags*):
7061

7162
- tag [`cakephp4`](https://github.com/mirko-pagliai/cakephp-database-backup/releases/tag/cakephp4), which requires at
7263
least PHP `>=7.4.0` and CakePHP `^4.0`.
@@ -84,36 +75,44 @@ The plugin uses some configuration parameters. See our wiki:
8475

8576
If you want to send backup files by email, remember to set up your application
8677
correctly so that it can send emails. For more information on how to configure
87-
your application, see the [Cookbook](https://book.cakephp.org/4.0/en/core-libraries/email.html#configuring-transports).
78+
your application, see the [Cookbook](https://book.cakephp.org/5/en/core-libraries/email.html#configuring-transports).
8879

8980
## How to use
81+
9082
See our wiki:
91-
* [Export backups as cron jobs](https://github.com/mirko-pagliai/cakephp-database-backup/wiki/Export-backups-as-cron-jobs)
92-
* [How to use the BackupExport utility](https://github.com/mirko-pagliai/cakephp-database-backup/wiki/How-to-use-the-BackupExport-utility)
93-
* [How to use the BackupImport utility](https://github.com/mirko-pagliai/cakephp-database-backup/wiki/How-to-use-the-BackupImport-utility)
94-
* [How to use the BackupManager utility](https://github.com/mirko-pagliai/cakephp-database-backup/wiki/How-to-use-the-BackupManager-utility)
95-
* [How to use the BackupShell](https://github.com/mirko-pagliai/cakephp-database-backup/wiki/How-to-use-the-BackupShell)
83+
* [How to use commands](https://github.com/mirko-pagliai/cakephp-database-backup/wiki/How-to-use-commands)
84+
* [Export backups as cron jobs](https://github.com/mirko-pagliai/cakephp-database-backup/wiki/Export-backups-as-cron-jobs)
85+
* [How to use the BackupExport utility](https://github.com/mirko-pagliai/cakephp-database-backup/wiki/How-to-use-the-BackupExport-utility)
86+
* [How to use the BackupImport utility](https://github.com/mirko-pagliai/cakephp-database-backup/wiki/How-to-use-the-BackupImport-utility)
87+
* [How to use the BackupManager utility](https://github.com/mirko-pagliai/cakephp-database-backup/wiki/How-to-use-the-BackupManager-utility)
9688

97-
And refer to our [API](//mirko-pagliai.github.io/cakephp-database-backup).
89+
Before opening an issue, check this list of [common issues](https://github.com/mirko-pagliai/cakephp-database-backup/wiki/Common-issues).
9890

9991
## Testing
100-
Tests are run for only one driver at a time, by default `mysql`.
101-
To choose another driver to use, you can set the `driver_test` environment variable before running `phpunit`.
92+
93+
Normally tests are only run on one driver at a time, by default `mysql`.
94+
95+
To run tests with another driver, you can use the scripts defined in `composer.json`:
10296

10397
For example:
10498
```bash
105-
driver_test=sqlite vendor/bin/phpunit
106-
driver_test=postgres vendor/bin/phpunit
99+
$ composer test
100+
$ composer test-postgres
101+
$ composer test-sqlite
107102
```
108103

109-
Alternatively, you can set the `db_dsn` environment variable, indicating the connection parameters. In this case, the driver type will still be detected automatically.
104+
Instead, to run tests with all drivers, you can use the `test-all` script (individual tests are chained together).
105+
106+
For individual drivers, alternatively you can set the `db_dsn` environment variable, indicating the connection
107+
parameters. In this case, the driver type will still be detected automatically.
110108

111109
For example:
112110
```bash
113111
db_dsn=sqlite:///' . TMP . 'example.sq3 vendor/bin/phpunit
114112
```
115113

116114
## Versioning
115+
117116
For transparency and insight into our release cycle and to maintain backward
118117
compatibility, *DatabaseBackup* will be maintained under the
119118
[Semantic Versioning guidelines](http://semver.org).

composer.json

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
},
2020
"require-dev": {
2121
"cakephp/cakephp-codesniffer": "^5.0",
22+
"cakedc/cakephp-phpstan": "^3.2",
2223
"cakephp/migrations": "^4.0",
23-
"phpunit/phpunit": "^10.1.0 <=10.5.3",
24+
"phpunit/phpunit": "^10.5.5 || ^11.1.3",
2425
"phpstan/phpstan": "^1.10.38",
25-
"vimeo/psalm": "^5.15.0"
26+
"vimeo/psalm": "^5.15.0|~6.0"
2627
},
2728
"autoload": {
2829
"psr-4": {
@@ -47,15 +48,22 @@
4748
],
4849
"cs-check": "phpcs --colors -p",
4950
"cs-fix": "phpcbf --colors -p",
50-
"test": "rm -f -r /tmp/cake* && phpunit && driver_test=sqlite phpunit && driver_test=postgres phpunit --colors=always",
51-
"coverage": "XDEBUG_MODE=coverage phpunit --coverage-html=coverage",
5251
"phpstan": "phpstan analyse",
5352
"psalm": "psalm --php-version=8.2",
5453
"stan": [
5554
"@phpstan",
5655
"@psalm"
5756
],
58-
"update-lowest": "@composer update --prefer-lowest"
57+
"update-lowest": "@composer update --prefer-lowest",
58+
"test-all": [
59+
"@test",
60+
"@test-postgres",
61+
"@test-sqlite"
62+
],
63+
"test": "phpunit --colors=always",
64+
"test-postgres": "driver_test=postgres phpunit --colors=always",
65+
"test-sqlite": "driver_test=sqlite phpunit --colors=always",
66+
"coverage": "XDEBUG_MODE=coverage phpunit --coverage-html=coverage"
5967
},
6068
"config": {
6169
"allow-plugins": {

0 commit comments

Comments
 (0)