Skip to content

Releases: mirko-pagliai/cakephp-database-backup

2.13.3

18 Dec 18:56
52918f2
Compare
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
Compare
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
Compare
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
Compare
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
Compare
Choose a tag to compare
  • updated for php-tools 1.8.

What's Changed

Full Changelog: 2.12.2...2.12.3

2.12.2

25 Oct 10:24
90ac332
Compare
Choose a tag to compare
  • improved and fixed a bug for ExportCommand and ImportCommand, in handling some exceptions;
  • it no longer needs the me-tools package. This removes several (useless) dependencies;
  • some, possible changes that prepare it for CakePHP 5 and PHPUnit 10 (issue #97);
  • little fixes. Fixed some deprecations for CakePHP 4.5 (issue #97);
  • improved BackuManager::index() method, also regarding the correct files sorting. This also solves a small bug for
    the rotate() method (which precisely affects index()). The index() method now returns a collection of arrays (
    and no longer a collection of Entity);
  • some testing methods that have been missing for a long time have been added;
  • the BackupTrait::getDriverName() method can no longer be static;
  • removed (old and useless) BaseCommandTestCase class;
  • added tests for PHP 8.2.

What's Changed

Full Changelog: 2.12.1...2.12.2

2.12.1

18 Jul 11:04
527328a
Compare
Choose a tag to compare
  • fixed a little bug in the bootstrap.php file;
  • the Exceptionist class provided by me-tools is no longer used (in anticipation of an upcoming deprecation).

What's Changed

Full Changelog: 2.11.1...2.12.1

2.12.0

06 Jun 17:54
7f52c20
Compare
Choose a tag to compare

Below is the complete changelog, but it is important to point out the most important things:

  1. the BackupExport and BackupImport classes extend the AbstractBackupUtility class thus offering the common code used by both;
  2. previously the driver classes took care directly (and in part) of executing commands in the shell. This didn't make much sense.
    Now the driver classes just implement the events (because they are different depending on the driver) and provide the correct instructions to the BackupExport and BackupImport classes to execute commands in the shell, which are then executed directly by these classes.
    This makes much more sense and the code has been reorganized in a reasonable and effective way. The actual export/import operations are done by BackupExport and BackupImport, which interface with the driver classes to know exactly how to do it.
    For example, the old Driver::_exec() method has become AbstractBackupUtility::getProcess();
  3. for this same reason, while the events remain implemented to the driver classes (for the reasons already explained...), those events are dispatched by BackupExport and BackupImport and no longer by the drivers themselves.
    So, for example, when BackupExport is going to export a backup (Backup.beforeExport event) it's like saying to the driver "hey, I'm going to export, do what you need to do and that's specific to your driver!";
  4. the 2.11.1 release introduced the DatabaseBackup.processTimeout configuration, thus allowing to set a timeout for commands executed in the shell, which is particularly useful for very large databases that require non-standard times to export/import backups. This was requested with issue #88, but this only allowed setting a global value (valid for the whole plugin).
    Now the timeout() method has been added for BackupExport and BackupImport classes and the --timeout (-t short) option has been added for the ExportCommand and ImportCommand, which allows you to set a timeout at runtime.
  5. some methods were implemented inside BackupTrait and available for the whole plugin, but really used in more specific contexts, and for this they have been moved. Other methods (internal and not accessible to the end user) offered unnecessary and unused arguments, which have been removed.
    Finally (and most importantly!), some methods allowed us to specify an alternative "custom" connection as an argument. But being internal methods, not public and therefore not accessible to the end user, this was useless, always ending up using the global configuration of DatabaseBackup.connection. So these arguments have been removed and only the global configuration is used, as it would be anyway.
    However this last consideration leads me to notice that in the plugin it is not possible to change the connection in use at runtime. This is of no use to me, since the applications in which I use this plugin work with only one database. But since CakePHP allows you to switch connections at runtime, this plugin should be able to do that too. This is a feature that may be implemented in the future if there is demand.

In summary, even if the lines of code are the same due to the new implementations, all the code has been simplified, streamlined and made more effective.

Finally, the wiki was updated, as it was sometimes referencing functions/code that no longer exist. And the whole description of the code itself has been extensively revised.

Changelog:

  • added AbstractBackupUtility::timeout() method, so now BackupExport/BackupImport utilities have a method to set the
    timeout for shell commands at runtime. Added --timeout option (short: -t) for ExportCommand/ImportCommand;
  • the events (Backup.beforeExport, Backup.afterExport, Backup.beforeImport, Backup.afterImport, which remain
    implemented by the driver classes) are directly dispatched by the BackupExport::export() and BackupImport::import()
    methods, and no longer by the drivers themselves;
  • added the AbstractBackupUtility abstract class that provides the code common to BackupExport and BackupImport,
    with the new AbstractBackupUtility::__get() magic method for reading BackupExport/BackupImport properties;
  • removed $Driver public property for BackupExport/BackupImport and added AbstractBackupUtility::getDriver() method;
  • the abstract Driver class has become AbstractDriver and no longer takes a connection as constructor argument, but
    directly uses the one set by the configuration. The old Driver::_exec() method has been moved and has become
    AbstractBackupUtility::getProcess(). The old Driver::export() and Driver::import() methods no longer exist and
    their code has been "absorbed" into the BackupExport::export() and BackupImport::import() methods;
  • BackupTrait::getDriver() method has become AbstractBackupUtility::getDriver();
  • BackupTrait::getDriverName() and AbstractBackupUtility::getDriver() no longer accept a connection as argument, but
    directly use the one set by the configuration;
  • the BackupExport::export() and BackupImport::import() methods can return the filename path on success or false
    if the Backup.beforeExport/Backup.beforeImport events are stopped;
  • Driver::_getExecutable(), Driver::_getExportExecutable() and Driver::_getImportExecutable() have become
    Driver::getExecutable(), Driver::getExportExecutable() and Driver::getImportExecutable();
  • the Driver::getConfig() method no longer accepts null as argument, but only a string as key, since there is no
    need to return the whole configuration;
  • MySql::getAuthFile() method has become getAuthFilePath(), to be more understandable;
  • MySql::deleteAuthFile() method returns void (there is no need for it to return anything);
  • removed useless TestCase::getMockForAbstractDriver() method;
  • removed useless BackupExport::$config property;
  • improved the ExportCommand class;
  • completely improved the BackupImportTest tests.

What's Changed

Full Changelog: 2.11.1...2.12.0

2.11.1

01 Jun 15:46
bedbd57
Compare
Choose a tag to compare
  • added the DatabaseBackup.processTimeout configuration, which allows you to set a timeout for commands that will be
    executed in sub-processes (which by default is 60 seconds) and which can be useful for exporting/importing large
    databases (see issue #88). Any options to change
    this timeout from ImportCommand/ExportCommand will be implemented later;
  • guaranteed to work with all versions of CakePHP 4;
  • added all property types to all classes;
  • upgraded to the new fixture system;
  • updated for php-tools 1.7.4;
  • tests have been made compatible with Xampp on Windows;
  • many, small improvements to the code and tests, also suggested by PhpStorm.

What's Changed

Full Changelog: 2.11.0...2.11.1

2.11.0

06 Feb 16:50
5491e07
Compare
Choose a tag to compare
  • requires at least PHP 7.4;
  • added MySql::getAuthFile() method. So the MySql::$auth property is now private;
  • createBackup() and createSomeBackups() are now testing global functions and no longer methods provided by the
    TestCase class;
  • added CommandTestCase to test commands;
  • many, small tweaks to code and descriptions.

This version also fixed the #85 issue.

What's Changed

Full Changelog: 2.10.2...2.11.0