Releases: mirko-pagliai/cakephp-database-backup
Releases · mirko-pagliai/cakephp-database-backup
2.12.2
- improved and fixed a bug for
ExportCommandandImportCommand, in handling some exceptions; - it no longer needs the
me-toolspackage. 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
therotate()method (which precisely affectsindex()). Theindex()method now returns a collection of arrays (
and no longer a collection ofEntity); - 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)
BaseCommandTestCaseclass; - added tests for PHP 8.2.
What's Changed
- Develop by @mirko-pagliai in #98
Full Changelog: 2.12.1...2.12.2
2.12.1
- fixed a little bug in the
bootstrap.phpfile; - the
Exceptionistclass provided by me-tools is no longer used (in anticipation of an upcoming deprecation).
What's Changed
- Develop next release by @mirko-pagliai in #93
- Develop by @mirko-pagliai in #94
Full Changelog: 2.11.1...2.12.1
2.12.0
Below is the complete changelog, but it is important to point out the most important things:
- the
BackupExportandBackupImportclasses extend theAbstractBackupUtilityclass thus offering the common code used by both; - 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 theBackupExportandBackupImportclasses 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 byBackupExportandBackupImport, which interface with the driver classes to know exactly how to do it.
For example, the oldDriver::_exec()method has becomeAbstractBackupUtility::getProcess(); - for this same reason, while the events remain implemented to the driver classes (for the reasons already explained...), those events are dispatched by
BackupExportandBackupImportand no longer by the drivers themselves.
So, for example, whenBackupExportis going to export a backup (Backup.beforeExportevent) 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!"; - the 2.11.1 release introduced the
DatabaseBackup.processTimeoutconfiguration, 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 thetimeout()method has been added forBackupExportandBackupImportclasses and the--timeout(-tshort) option has been added for theExportCommandandImportCommand, which allows you to set a timeout at runtime. - some methods were implemented inside
BackupTraitand 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 ofDatabaseBackup.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 nowBackupExport/BackupImportutilities have a method to set the
timeout for shell commands at runtime. Added--timeoutoption (short:-t) forExportCommand/ImportCommand; - the events (
Backup.beforeExport,Backup.afterExport,Backup.beforeImport,Backup.afterImport, which remain
implemented by the driver classes) are directly dispatched by theBackupExport::export()andBackupImport::import()
methods, and no longer by the drivers themselves; - added the
AbstractBackupUtilityabstract class that provides the code common toBackupExportandBackupImport,
with the newAbstractBackupUtility::__get()magic method for readingBackupExport/BackupImportproperties; - removed
$Driverpublic property forBackupExport/BackupImportand addedAbstractBackupUtility::getDriver()method; - the abstract
Driverclass has becomeAbstractDriverand no longer takes a connection as constructor argument, but
directly uses the one set by the configuration. The oldDriver::_exec()method has been moved and has become
AbstractBackupUtility::getProcess(). The oldDriver::export()andDriver::import()methods no longer exist and
their code has been "absorbed" into theBackupExport::export()andBackupImport::import()methods; BackupTrait::getDriver()method has becomeAbstractBackupUtility::getDriver();BackupTrait::getDriverName()andAbstractBackupUtility::getDriver()no longer accept a connection as argument, but
directly use the one set by the configuration;- the
BackupExport::export()andBackupImport::import()methods can return the filename path on success orfalse
if theBackup.beforeExport/Backup.beforeImportevents are stopped; Driver::_getExecutable(),Driver::_getExportExecutable()andDriver::_getImportExecutable()have become
Driver::getExecutable(),Driver::getExportExecutable()andDriver::getImportExecutable();- the
Driver::getConfig()method no longer acceptsnullas argument, but only a string as key, since there is no
need to return the whole configuration; MySql::getAuthFile()method has becomegetAuthFilePath(), 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::$configproperty; - improved the
ExportCommandclass; - completely improved the
BackupImportTesttests.
What's Changed
- Develop next release by @mirko-pagliai in #93
- Develop by @mirko-pagliai in #94
Full Changelog: 2.11.1...2.12.0
2.11.1
- added the
DatabaseBackup.processTimeoutconfiguration, 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 fromImportCommand/ExportCommandwill 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-tools1.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
- Develop by @mirko-pagliai in #89
- Develop by @mirko-pagliai in #91
- upgraded to the new fixture system by @mirko-pagliai in #90
- Develop by @mirko-pagliai in #92
Full Changelog: 2.11.0...2.11.1
2.11.0
- requires at least PHP 7.4;
- added
MySql::getAuthFile()method. So theMySql::$authproperty is now private; createBackup()andcreateSomeBackups()are now testing global functions and no longer methods provided by the
TestCaseclass;- added
CommandTestCaseto test commands; - many, small tweaks to code and descriptions.
This version also fixed the #85 issue.
What's Changed
- Develop by @mirko-pagliai in #86
- Update CHANGELOG.md by @mirko-pagliai in #87
Full Changelog: 2.10.2...2.11.0
2.10.2
- added tests for PHP 8.1;
- little fixes for phpstan, psalm and for the composer.json file.
What's Changed
- Develop by @mirko-pagliai in #84
Full Changelog: 2.10.1...2.10.2
2.10.1
- stable version;
- updated for
php-tools1.5.8.
What's Changed
- now allows to configure and customize via bootstrap the executable co… by @mirko-pagliai in #77
- Develop export executable with compression by @mirko-pagliai in #78
- backtrack (compared to version
2.9.0): all tracks are auto-discovered, by @mirko-pagliai in #79 - fixed some tests that produced false positives by @mirko-pagliai in #80
- Develop by @mirko-pagliai in #81
- Develop by @mirko-pagliai in #82
- Develop by @mirko-pagliai in #83
Full Changelog: 2.9.1...2.10.1
2.10.0-beta1
- 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 theDriverclass have been removed and incorporated
into the new_getExportExecutable()and_getImportExecutable();BackupTrait::$validExtensionshas been removed and replaced by the
DATABASE_BACKUP_EXTENSIONSconstant;- postgres and sqlite commands are also properly escaped;
- many little fixes and many code simplifications.
What's Changed
- now allows to configure and customize via bootstrap the executable co… by @mirko-pagliai in #77
- Develop export executable with compression by @mirko-pagliai in #78
- backtrack (compared to version
2.9.0): all tracks are auto-discovered, by @mirko-pagliai in #79 - fixed some tests that produced false positives by @mirko-pagliai in #80
- Develop by @mirko-pagliai in #81
Full Changelog: 2.9.1...2.10.0-beta1
2.9.2
- 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
- now allows to configure and customize via bootstrap the executable co… by @mirko-pagliai in #77
- Develop export executable with compression by @mirko-pagliai in #78
- backtrack (compared to version
2.9.0): all tracks are auto-discovered, by @mirko-pagliai in #79 - fixed some tests that produced false positives by @mirko-pagliai in #80
Full Changelog: 2.9.1...2.9.2
2.9.1
- all shell arguments are now correctly escaped.