cakephp-database-backup

DatabaseBackup is a CakePHP plugin to export, import and manage database backups

OTHER License

Downloads
20.1K
Stars
19
Committers
3

Bot releases are visible (Hide)

cakephp-database-backup - 2.13.2

Published by mirko-pagliai 2 days ago

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

What's Changed

Full Changelog: https://github.com/mirko-pagliai/cakephp-database-backup/compare/2.13.1...2.13.2

cakephp-database-backup - 2.13.1 Latest Release

Published by mirko-pagliai 5 months ago

cakephp-database-backup - 2.13.0

Published by mirko-pagliai 10 months ago

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

What's Changed

Full Changelog: https://github.com/mirko-pagliai/cakephp-database-backup/compare/2.12.3...2.13.0

cakephp-database-backup - 2.12.3

Published by mirko-pagliai 10 months ago

cakephp-database-backup - 2.12.2

Published by mirko-pagliai 12 months ago

  • 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: https://github.com/mirko-pagliai/cakephp-database-backup/compare/2.12.1...2.12.2

cakephp-database-backup - 2.12.1

Published by mirko-pagliai over 1 year ago

  • 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: https://github.com/mirko-pagliai/cakephp-database-backup/compare/2.11.1...2.12.1

cakephp-database-backup - 2.12.0

Published by mirko-pagliai over 1 year ago

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: https://github.com/mirko-pagliai/cakephp-database-backup/compare/2.11.1...2.12.0

cakephp-database-backup - 2.11.1

Published by mirko-pagliai over 1 year ago

  • 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: https://github.com/mirko-pagliai/cakephp-database-backup/compare/2.11.0...2.11.1

cakephp-database-backup - 2.11.0

Published by mirko-pagliai over 1 year ago

  • 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 https://github.com/mirko-pagliai/cakephp-database-backup/issues/85 issue.

What's Changed

Full Changelog: https://github.com/mirko-pagliai/cakephp-database-backup/compare/2.10.2...2.11.0

cakephp-database-backup - 2.10.2

Published by mirko-pagliai about 2 years ago

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

What's Changed

Full Changelog: https://github.com/mirko-pagliai/cakephp-database-backup/compare/2.10.1...2.10.2

cakephp-database-backup - 2.10.1

Published by mirko-pagliai almost 3 years ago

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

What's Changed

Full Changelog: https://github.com/mirko-pagliai/cakephp-database-backup/compare/2.9.1...2.10.1

cakephp-database-backup - 2.10.0-beta1

Published by mirko-pagliai almost 3 years ago

  • 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: https://github.com/mirko-pagliai/cakephp-database-backup/compare/2.9.1...2.10.0-beta1

cakephp-database-backup - 2.9.2

Published by mirko-pagliai almost 3 years ago

  • 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: https://github.com/mirko-pagliai/cakephp-database-backup/compare/2.9.1...2.9.2

cakephp-database-backup - 2.9.1

Published by mirko-pagliai about 3 years ago

  • all shell arguments are now correctly escaped.
cakephp-database-backup - 2.9.0

Published by mirko-pagliai about 3 years ago

  • now uses symfony/process to execute import and export shell commands. This
    also allows for better handling of errors reported in the shell. The
    DatabaseBackup.redirectStderrToDevNull config key has been removed;
  • only the binaries needed for the database driver used are auto-discovered;
  • tests are now only run for one driver at a time, by default mysql. You can
    choose another driver by setting driver_test or db_dsn environment
    variables before running phpunit;
  • migration to github actions.
cakephp-database-backup - 2.8.6

Published by mirko-pagliai over 3 years ago

  • fixed bootstrap, mkdir errors are no longer suppressed;
  • extensive improvement of function descriptions and tags. The level of phpstan
    has been raised.
cakephp-database-backup - 2.8.5

Published by mirko-pagliai over 3 years ago

  • ready for php 8.0;
  • extensive improvement of function descriptions and tags.
cakephp-database-backup - 2.8.4

Published by mirko-pagliai over 3 years ago

  • BackupManager::delete() returns the full path;
  • all methods provided by BackupManager can now be called statically, except
    for the send() method;
  • extensive improvement of function descriptions and tags;
  • ready for phpunit 9.
cakephp-database-backup - 2.8.3

Published by mirko-pagliai almost 4 years ago

  • updated for php-tools 1.4.5;
  • added phpstan, so fixed some code.
cakephp-database-backup - 2.8.2

Published by mirko-pagliai about 4 years ago

  • updated for php-tools 1.4.1.