Releases: mirko-pagliai/cakephp-database-backup
2.13.3
- added
--reverse
option for theIndexCommand
(issue #96); - the
BackupTrait::getAbsolutePath()
method is now able to recognize a path relative to itsROOT
, so as to be able
to take advantage of the autocompletion already offered by the bash console when, for example, you use theimport
command from theROOT
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
- Bump symfony/process from 7.1.5 to 7.1.7 by @dependabot in #107
- requires at least
symfony/process
7.1.7
, due to a security vulner… by @mirko-pagliai in #108
New Contributors
- @dependabot made their first contribution in #107
Full Changelog: 2.13.2...2.13.3
2.13.2
- no longer needs
php-tools
; - removed useless
CommandTestCase
; - little fixes and updates.
What's Changed
- Develop by @mirko-pagliai in #105
- Develop by @mirko-pagliai in #106
Full Changelog: 2.13.1...2.13.2
2.13.1
- updated for
php-tools
1.10.0.
What's Changed
- Develop by @mirko-pagliai in #103
- Develop by @mirko-pagliai in #104
Full Changelog: 2.13.0...2.13.1
2.13.0
- requires at least PHP 8.1, PHPUnit 10 and CakePHP 5.0;
- added tests for PHP 8.3.
What's Changed
- Develop by @mirko-pagliai in #100
- Php8.1 by @mirko-pagliai in #101
- Develop by @mirko-pagliai in #102
Full Changelog: 2.12.3...2.13.0
2.12.3
- updated for
php-tools
1.8.
What's Changed
- Develop by @mirko-pagliai in #99
Full Changelog: 2.12.2...2.12.3
2.12.2
- improved and fixed a bug for
ExportCommand
andImportCommand
, 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
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)
BaseCommandTestCase
class; - 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.php
file; - the
Exceptionist
class 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
BackupExport
andBackupImport
classes extend theAbstractBackupUtility
class 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 theBackupExport
andBackupImport
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 byBackupExport
andBackupImport
, 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
BackupExport
andBackupImport
and no longer by the drivers themselves.
So, for example, whenBackupExport
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!"; - 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 thetimeout()
method has been added forBackupExport
andBackupImport
classes and the--timeout
(-t
short) option has been added for theExportCommand
andImportCommand
, which allows you to set a timeout at runtime. - 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 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
/BackupImport
utilities have a method to set the
timeout for shell commands at runtime. Added--timeout
option (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
AbstractBackupUtility
abstract class that provides the code common toBackupExport
andBackupImport
,
with the newAbstractBackupUtility::__get()
magic method for readingBackupExport
/BackupImport
properties; - removed
$Driver
public property forBackupExport
/BackupImport
and addedAbstractBackupUtility::getDriver()
method; - the abstract
Driver
class has becomeAbstractDriver
and 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.beforeImport
events are stopped; Driver::_getExecutable()
,Driver::_getExportExecutable()
andDriver::_getImportExecutable()
have become
Driver::getExecutable()
,Driver::getExportExecutable()
andDriver::getImportExecutable()
;- the
Driver::getConfig()
method no longer acceptsnull
as 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::$config
property; - improved the
ExportCommand
class; - completely improved the
BackupImportTest
tests.
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.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 fromImportCommand
/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
- 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::$auth
property is now private; createBackup()
andcreateSomeBackups()
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
- Develop by @mirko-pagliai in #86
- Update CHANGELOG.md by @mirko-pagliai in #87
Full Changelog: 2.10.2...2.11.0