Skip to content

Releases: mirko-pagliai/cakephp-database-backup

2.12.2

25 Oct 10:24
90ac332

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

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

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

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

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

2.10.2

21 Sep 16:42
b2d0fe0

Choose a tag to compare

  • added tests for PHP 8.1;
  • little fixes for phpstan, psalm and for the composer.json file.

What's Changed

Full Changelog: 2.10.1...2.10.2

2.10.1

05 Jan 18:51
08e069f

Choose a tag to compare

  • stable version;
  • updated for php-tools 1.5.8.

What's Changed

Full Changelog: 2.9.1...2.10.1

2.10.0-beta1

25 Nov 18:27
c6a9b92

Choose a tag to compare

2.10.0-beta1 Pre-release
Pre-release
  • now allows to configure and customize via bootstrap the executable commands to
    import and export databases, for each driver, with placeholders;
  • __exportExecutableWithCompression() and _importExecutableWithCompression()
    methods provided by the Driver class have been removed and incorporated
    into the new _getExportExecutable() and _getImportExecutable();
  • BackupTrait::$validExtensions has been removed and replaced by the
    DATABASE_BACKUP_EXTENSIONS constant;
  • postgres and sqlite commands are also properly escaped;
  • many little fixes and many code simplifications.

What's Changed

Full Changelog: 2.9.1...2.10.0-beta1

2.9.2

25 Nov 18:26

Choose a tag to compare

  • added BackupTrait::getDriverName() static method; getConnection() and
    getDriver() methods are now static;
  • backtrack (compared to version 2.9.0): all tracks are auto-discovered,
    otherwise it would not be possible to change the connection you want to work
    on on the fly;
  • fixed some tests that produced false positives.

What's Changed

Full Changelog: 2.9.1...2.9.2

2.9.1

14 Oct 17:09
2d946f4

Choose a tag to compare

  • all shell arguments are now correctly escaped.