Skip to content

Releases: mirko-pagliai/cakephp-database-backup

2.14.1

15 Apr 15:55
ec7e8b3

Choose a tag to compare

  • many improvements for the AbstractExecutor abstract class;
  • method AbstractBackupUtility::getExecutor() now accepts the optional $Connection argument. The getConnection()
    method has been removed;
  • getExecutable(), getExportExecutable() and getImportExecutable() methods provided by AbstractExecutor have
    been renamed as getCommand(), getExportCommand() and getImportCommand(). This is because they never actually
    returned "executables", but rather commands. This makes their name clearer. For getExportExecutable() and
    getImportExecutable() methods backwards compatibility is ensured via the magic method _call() (with deprecation);
  • significant improvement for SqlExecutor. Also, improved related tests;
  • the DriverTestCase abstract class, used in particular for old, no longer existing "Driver" classes, has been removed.
    Tests involving "Executor" classes do not use this class, as they have no need for it. The PostgresExecutorTest test
    class has also been removed, since the class it covers, by default, does not implement anything that the parent class
    does not;
  • all PHPUnit deprecations have finally been removed;
  • added symfony/polyfill-php83. This allowed the #[Override] attribute to be added to all affected methods;
  • we also begin to apply the UsesClass attribute and remove the old @uses tag;
  • updated for cakedc/cakephp-phpstan to ^4.0 (and so phpstan/phpstan to 2.1.8)

What's Changed

Full Changelog: 2.14.0...2.14.1

2.14.0

20 Mar 17:09
fb20c2a

Choose a tag to compare

Caution

This release starts the new 2.14.x branch.
For the end user, there should be no major problems upgrading from 2.13.x, except for some possible deprecations. It is recommended that you perform any necessary checks before and after upgrading.

  • added new magic AbstractBackupUtility::__call() method. This allows BackupExport and BackupImport to access the
    property via the magic methods getX() (be careful not to confuse the getCompression() method, which now returns
    the $compression property of BackupExport, with the old method provided by BackupTrait, which had been
    deprecated and has now been removed);
  • class DatabaseBackup\Driver\AbstractDriver has become DatabaseBackup\Executor\AbstractExecutor, class
    DatabaseBackup\Driver\Mysql has become DatabaseBackup\Executor\MysqlExecutor, class DatabaseBackup\Driver\Postgres
    has become DatabaseBackup\Executor\PostgresExecutor and class DatabaseBackup\Driver\Sqlite has become
    DatabaseBackup\Executor\SqliteExecutor. Aliases have been added to old classes for backwards compatibility, but will
    be removed in a future release;
  • added new AbstractBackupUtility::getExecutor() that gets the Executor instance (old Driver classes now renamed)
    according to the connection;
  • passing the $compression argument as a string or null to BackupExport::compression() had been deprecated and has
    been removed (backwards compatibility removed);
  • the BackupManager::index methods no longer returns, in the array for each file, the filename key;
  • the BackupExport::filename() and BackupImport::filename() methods now throw an IOException exception (rather
    than a LogicException) if the target (directory) is not writable/the filename already exists/the filename is not
    readable;
  • the BackupExport::export() and BackupImport::import() methods now throw a RuntimeException exception (rather
    than a LogicException) when export/import fails;
  • the BackupImport::import() methods now throws a BadMethodCallException exception (rather than a LogicException)
    when the filename has not been set;
  • fixed a deprecation regarding a Finder::sort() method call;
  • the TestCase::createSomeBackups() method has been improved;
  • tests for MysqlExecutor (hence MysqlExecutorTest) can be run regardless of the driver in use;
  • the AbstractBackupUtility::getDriver() method is deprecated and will be removed in a future release. Use instead the
    getExecutor() method;
  • the AbstractBackupUtility::__get() method is deprecated and will be removed in a future release;
  • DeleteAllCommand, RotateCommand and SendCommand classes had been deprecated and have been removed;
  • the getConnection() and getDriverName() methods provided by BackupTrait are deprecated and will be removed in a
    future release. The entire BackupTrait trait is now deprecated and will be removed in a future release;
  • getAbsolutePath(), getCompression(), getExtension() and getValidCompressions() methods provided by
    BackupTrait had been deprecated and has been removed;
  • all classes, methods and code related to sending backups via email had been deprecated, and now they have been
    removed. So, the BackupManager::send() method (and, consequently, the internal BackupManager::getEmailInstance()
    method), the BackupExport::send() method and the send option for the ExportCommand have been removed;
  • the delete() and deleteAll() methods provided by BackupManager had been deprecated and have been removed;
  • the rtr() global function had been deprecated and has been removed.

What's Changed

Full Changelog: 2.13.6...2.14.0

2.13.6

13 Mar 17:17
d0d5299

Choose a tag to compare

Important

If there are no particular needs (e.g. bug fixes, vulnerability fixes, etc.), this will be the last release of the 2.13 branch.

  • now all Driver classes (through the AbstractDriver class) have $Connection as their constructor argument, and
    therefore as their property. This argument is automatically passed by the AbstractBackupUtility::getDriver() method
    (which was already happening previously, but without any consequences).

What's Changed

Full Changelog: 2.13.5...2.13.6

2.13.5

12 Mar 15:59
4028a9a

Choose a tag to compare

Important

This new version 2.13.15, following 2.13.14 and 2.13.13, introduces many new deprecations, following the same deprecation logic already applied.

The code has been extensively optimized and with it also the tests, removing redundant methods, superfluous code, etc.
The tests are reviewed and rewritten, in addition to using the new attributes provided by the latest versions of PHPUnit.

This process has so far affected half of the available classes and will continue with the 2.14.x branch and will end only with the 2.15.x branch.

The user should not currently have problems upgrading on the same branch, but these deprecations (and some planned renamed classes) will be removed in future branches.

Starting with this release, it was decided to abandon the master/develop branch structure on GitHub and mirror the real branching of the code (e.g. the master branch is now 2.13.x and after this release it will become 2.14.x).
This allows for easy and transparent development on multiple branches at the same time.

A small regression in the coverage reported by Codecov is tentatively expected. But this is reasonably expected, as the application of the new PHPUnit attributes tightens the checks (and thus the coverage is now more real).

  • added new DatabaseBackup\Compression enum, with some methods useful for the complete management of compressions;
  • the BackupExport::compression() method now accepts a Compression value as its $compression argument. String and
    null values are still supported, but are now deprecated and will be removed in a future release. Additionally, if an
    invalid string is now passed as an argument, a InvalidArgumentException exception is thrown;
  • the BackupManager::index() method now returns, in the array for each file, a Compression enum value for the
    compression key (rather than a string or null), the absolute path for the path key, and the basename for the
    basename key. The filename key is still returned, but will be removed in version 2.14.0 (basename is more
    efficient). The extension key has already been removed, as it is now useless. The IndexCommand instead still
    carries the compression as a string (it couldn't be otherwise), while it also no longer reports the extension (also
    useless in this case);
  • the BackupExport class no longer directly handles the backup extension, which is automatically deduced from the
    value of Compression, now set by default to Compression::None (no compression) and which can always be changed
    with the compression() and (indirectly) filename() methods. For this reason, the BackupExport::$extension
    property no longer exists;
  • except for ExportCommand and ImportCommand, all other Command classes (including deprecated ones) now directly
    extend Cake\Console\BaseCommand. This means that they will no longer display connection information by default, but
    that makes sense since those classes only work on the filesystem;
  • added new Command::makeRelativeFilename() method. This will replace the global rtr() function, since only
    Command classes really need it;
  • the BackupImport::filename() method uses Compression to check the validity of the file you want to import (so it
    no longer checks its extension). This will throw a ValueError exception for invalid files;
  • the global test functions createBackup() and createSomeBackups() are now methods of the TestCase class (as they
    should be). The createBackup() method now has the $fakeBackup argument (false by default), which allows you to
    create a fake backup file (i.e. an empty file) Added tests;
  • added new AbstractBackupUtility::makeAbsoluteFilename() method. Since the BackupTrait::getAbsolutePath() method is
    now deprecated (see below), it provides the BackupExport and BackupImport classes (the only ones that really need
    it) with a method to construct absolute paths;
  • added OperationType enum, which is used by the AbstractDriver::getExecutable() private method;
  • the AbstractDriver::getBinary() method can now accept a Compression value as an argument (in addition to a
    string). Invalid values will now throw an InvalidArgumentException (rather than a LogicException);
  • the BackupManager::rotate() method throws an InvalidArgumentException (and no longer LogicException) for an
    invalid $rotate value. The method description has been corrected;
  • the code, introduced in version 2.13.3, that allows paths relative to ROOT, has been moved from
    BackupTrait::getAbsolutePath() method to ImportCommand::execute(), since it is the only one that takes advantage
    of it;
  • the DATABASE_BACKUP_EXTENSIONS constant no longer exists, as it is no longer needed due to the Compression enum;
  • the rtr() global function is deprecated and will be removed in a future release;
  • the RotateCommand class is deprecated and will be removed in a later release. For this reason, the ExportCommand
    class now uses the BackupManager::rotate() method to continue supporting the --rotate option;
  • getAbsolutePath(), getCompression(), getExtension() and getValidCompressions() methods provided by
    BackupTrait are deprecated. They will be removed in a future release;
  • the delete() and deleteAll() methods provided by BackupManager are deprecated. They will be removed in a future
    release. The few methods that need to delete files (e.g. rotation methods) implement the necessary code themselves;
  • compatibility with the transition from _cake_core_ to _cake_translations_ expected in CakePHP 5.1;
  • the BackupExport::$defaultExtension property no longer exists (by now it had become useless);
  • updated for the latest version of psalm.

What's Changed

Full Changelog: 2.13.4...2.13.5

2.13.4

13 Feb 16:14

Choose a tag to compare

Since all features related to sending backups via email have been deprecated with this release (and will be removed in 2.14.0), the Send backups via email wiki page has been added, which explains both the reason for the deprecation and how to implement that feature yourself.

The Common issues page has also been added.

Changelog:

  • fixed bug #119: BackupManager ignored the timezone of backup files, and consequently also IndexCommand;
  • fixed bug #111: for Mysql it first looks for mariadb and mariadb-dump executables, otherwise mysql
    and mysqldump executables;
  • all classes, methods and code related to sending backups via email are now deprecated. So, the BackupManager::send()
    method (and, consequently, also the internal BackupManager::getEmailInstance() method), the BackupExport::send()
    method, the SendCommand class and the send option for the ExportCommand are deprecated. All of these will be
    removed in a later release. No replacement is provided;
  • setting the DatabaseBackup.mailSender value of the configuration is deprecated (bootstrap checks that the value
    has not been set by the user);
  • the DeleteAllCommand is deprecated. Will be removed in a future release;
  • added tests for php 8.4;
  • all chainable methods of BackupExport and BackupImport classes now have the typehint for returning self. Updated
    descriptions;
  • updated phpunit to ^10.5.5 || ^11.1.3;
  • updated psalm to 6.x;
  • uses cakedc/cakephp-phpstan;
  • the old FrozenTime classes have been replaced with DateTime (which it was an alias for);
  • extensive revision of descriptions and tags of all classes and methods;
  • removed some errors related to phpcs, phpstan and psalm, previously silenced;
  • the README file has been updated for compatibility with older versions of CakePHP and PHP (branches have been
    removed and older versions are available as tags);
  • overall updated README file, updated links to CakePHP documentation. Some information has been moved from the
    README file to the (new) Common issues wiki page.

What's Changed

Full Changelog: 2.13.3...2.13.4

2.13.3

18 Dec 18:56
52918f2

Choose a tag to compare

  • added --reverse option for the IndexCommand (issue #96);
  • the BackupTrait::getAbsolutePath() method is now able to recognize a path relative to its ROOT, so as to be able
    to take advantage of the autocompletion already offered by the bash console when, for example, you use the import
    command from the ROOT and the backup directory is inside it;
  • fixed a bug for IndexCommand, data was not sorted correctly on individual rows. Improved testing;
  • slightly improved backup file sorting for BackupManager::index() method (this is useful when you have a lot of files);
  • requires at least symfony/process 7.1.7, due to this security vulnerability;
  • fixed some errors in localizations of some strings;
  • replaced deprecated getMockForAbstractClass() method in tests.

What's Changed

New Contributors

Full Changelog: 2.13.2...2.13.3

2.13.2

16 Oct 15:30
c1692aa

Choose a tag to compare

  • no longer needs php-tools;
  • removed useless CommandTestCase;
  • little fixes and updates.

What's Changed

Full Changelog: 2.13.1...2.13.2

2.13.1

10 May 16:21
cc97de0

Choose a tag to compare

  • updated for php-tools 1.10.0.

What's Changed

Full Changelog: 2.13.0...2.13.1

2.13.0

05 Jan 09:41
86efb56

Choose a tag to compare

  • requires at least PHP 8.1, PHPUnit 10 and CakePHP 5.0;
  • added tests for PHP 8.3.

What's Changed

Full Changelog: 2.12.3...2.13.0

2.12.3

03 Jan 17:11
ca56d12

Choose a tag to compare

  • updated for php-tools 1.8.

What's Changed

Full Changelog: 2.12.2...2.12.3