- 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.
- no longer needs
php-tools
; - removed useless
CommandTestCase
; - little fixes and updates.
- updated for
php-tools
1.10.0.
- requires at least PHP 8.1, PHPUnit 10 and CakePHP 5.0;
- added tests for PHP 8.3.
- updated for
php-tools
1.8.
- 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.
- 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).
- 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 becomeAbstractBackupUtility::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 becomeDriver::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.
- 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.
- 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 theTestCase
class;- added
CommandTestCase
to test commands; - many, small tweaks to code and descriptions.
- added tests for PHP 8.1;
- little fixes for phpstan, psalm and for the composer.json file.
- stable version;
- updated for
php-tools
1.5.8.
- 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 theDriver
class have been removed and incorporated into the new_getExportExecutable()
and_getImportExecutable()
;BackupTrait::$validExtensions
has been removed and replaced by theDATABASE_BACKUP_EXTENSIONS
constant;- postgres and sqlite commands are also properly escaped;
- many little fixes and many code simplifications.
- added
BackupTrait::getDriverName()
static method;getConnection()
andgetDriver()
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.
- all shell arguments are now correctly escaped.
- now uses
symfony/process
to execute import and export shell commands. This also allows for better handling of errors reported in the shell. TheDatabaseBackup.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 settingdriver_test
or ``db_dsnenvironment variables before running
phpunit`; - migration to github actions.
- fixed a small bug when using the numeric hostname (
127.0.0.1
or::1
) as the automatic backup filename; - export and import error messages are now more specific;
BackupExport
returns a more accurate error in case of invalid filename;- added
Driver::_exec()
method; - tests no longer fail with
DatabaseBackup.redirectStderrToDevNull
set tofalse
.
- fixed bootstrap,
mkdir
errors are no longer suppressed; - extensive improvement of function descriptions and tags. The level of
phpstan
has been raised.
- ready for php
8.0
; - extensive improvement of function descriptions and tags.
BackupManager::delete()
returns the full path;- all methods provided by
BackupManager
can now be called statically, except for thesend()
method; - extensive improvement of function descriptions and tags;
- ready for
phpunit
9.
- updated for
php-tools
1.4.5; - added
phpstan
, so fixed some code.
- updated for
php-tools
1.4.1.
- fixed I18n translations;
- fixed bug for
Command
class.
- updated for
cakephp
4 andphpunit
8.
- fixed bug for
Command
class.
BackupTrait::getBinary()
method has been moved toDriver
abstract class;BackupTrait::getTarget()
,BackupTrait::getDriverName()
andBackupTrait::getValidExtensions()
methods have been removed.
- tests have been optimized and speeded up;
- APIs are now generated by
phpDocumentor
and no longer byapigen
.
- little fixes.
- little fixes for
BackupManager
andBackupExport
classes; - added tests for lower dependencies;
- improved exception message when no binary file is found;
- no longer uses the
Folder
class.
- little fixes.
- added
BackupTrait::getDriverName()
method; BackupExport::compression()
takes a compression type name as string ornull
to disable compression;BackupExport::send()
takes a recipient's email address as string ornull
to disable sending backup;BackupTrait::getCompression()
returnsnull
with no compression;- the
DriverTestCase
class now implementstestExportOnFailure()
andtestImportOnFailure()
test methods; - improved printing of the backup table for the
IndexCommand
; - updated for
php-tools
1.2 andme-tools
2.18.7. - added API.
- added
DriverTestCase::getMockForDriver()
method; DriverTestCase::allRecords()
method renamed asgetAllRecords()
;- many small code fixes;
- requires
me-tools
package for dev; - removed
ConsoleIntegrationTestTrait
, because it is now sufficient to use the same trait provided byme-tools
; - updated for
php-tools
1.1.12.
BackupShell
has been replaced with console commands. Every method of the previous class is now aCommand
class;BackupManager::index()
returns a collection of backups;ConsoleIntegrationTestCase
has been replaced byConsoleIntegrationTestTrait
.TestCaseTrait
has been removed and its methods moved toTestCase
;- removed
DATABASE_BACKUP
constant; - updated for CakePHP 3.7.
- updated for CakePHP 3.6 and 3.7. Added
Plugin
class; - many small code fixes.
- now it uses the
mirko-pagliai/php-tools
package. This also replacesmirko-pagliai/reflection
; - removed
BackupTrait::getClassShortName()
method. Theget_class_short_name()
global function will be used instead.
- fixed bug trying to email a nonexistent backup;
VALID_COMPRESSIONS
andVALID_EXTENSIONS
constants have been replaced bygetValidCompressions()
andgetValidExtensions()
methods provided by theBackupTrait
class;- replaced
InternalErrorException
withInvalidArgumentException
andRuntimeException
. This allows compatibility with CakePHP 3.6 branch.
- full support for working under Windows;
- added
Driver::getConfig()
method, removedDriver::$config
property. This allows you to get the configuration values safely; - fixed a bug for export and import executables with Postgres databases;
- before importing a sqlite backup, each table is dropped, rather than deleting the database file;
- added
isWin()
global function; - tests can have
onlyUnix
oronlyWindows
group.
- added
ConsoleIntegrationTestCase
andTestCaseTrait
classes. Console tests have been simplified; - updated for CakePHP 3.5.
- when a backup is sent by mail, the mimetype is forced;
- fixed some tests.
- added
createBackup()
andcreateSomeBackups()
to theTestCase
class; BackupManager::_send()
has becomegetEmailInstance()
.
- fixed
composer.json
: the plugin requires at least version 3.4 of CakePHP.
afterExport()
,afterImport()
,beforeExport()
andbeforeImport
methods are now real events;- now you can choose if you want to redirects stderr to
/dev/null
. This suppresses the output of executed commands.
- added support for Postgres databases;
- all
export()
andimport()
methods have been moved to theDriver
class; - added
afterExport()
,afterImport()
,beforeExport()
andbeforeImport
methods to theDriver
class; getCompression()
andgetExtension()
moved fromDriver
toBackupTrait
class, because these methods are not strictly related to the database engine you are using;- removed
getValidExtensions()
andgetValidCompressions()
methods fromDriver
class, because extensions and compressions are the same for any database engine; - removed
getDefaultExtension()
method fromDriver
class, because the default extension is the same for any database engine.
- the plugin has been renamed as
DatabaseBackup
(cakephp-database-backup
); - the code has been completely rewritten to work with drivers, so it can also work with other database engines;
- added support for Sqlite database;
- checks the return status code when it runs
mysql
andmysqldump
from the command line.
- fixed bugs in the table output for the
BackupShell::index()
method; _storeAuth()
methods fromBackupExport
andBackupImport
classes are now private;- added
BackupTrait::getConnection()
method; - added
BackupTrait::getValidCompressions()
method.
- added
BackupShell::send()
andBackupManager::send()
methods to send backup files via mail; - added
--send
option toBackupShell::export()
; - added
BackupExport::send()
to set up the email recipient, so by calling theexport()
method the backup file will be sent via email; - added
BackupTrait
, that provides some methods used by all other classes; - added
rtr()
(relative to root) global function. This simplifies the output of some methods provided byBackupShell
; - global functions
compressionFromFile()
,extensionFromCompression()
andextensionFromFile()
have been replaced with thegetCompression()
andgetExtension()
methods provided by theBackupTrait
; - all methods belonging to the
BackupManager
class are no longer static.
- the target directory is created automatically, if it does not exist;
BackupManager::index()
returns an array of entities;- added
MYSQL_BACKUP
constant.
- methods that have been deprecated with CakePHP 3.4 have been replaced;
- updated for CakePHP 3.4.
- added
BackupManager::deleteAll()
andBackupShell::deleteAll()
methods; - improved tests. Also errors in the shell are checked.
- first release.