mirko-pagliai/cakephp-database-backup
Composer 安装命令:
composer require mirko-pagliai/cakephp-database-backup
包简介
Database Backup plugin for CakePHP
README 文档
README
DatabaseBackup is a CakePHP plugin to export, import and manage database backups. Currently, the plugin supports MySql, Postgres and Sqlite databases.
Did you like this plugin? Its development requires a lot of time for me. Please consider the possibility of making a donation: even a coffee is enough! Thank you.
Requirements
DatabaseBackup requires:
mariadbandmariadb-dumpfor MariaDB/MySql databases (if you still usemysql/mysqldump, see here);pg_dumpandpg_restorefor Postgres databases;sqlite3for Sqlite databases.
Optionally, if you want to handle compressed backups, bzip2 and gzip are
also required.
The installation of these binaries may vary depending on your operating system.
Installation
You can install the plugin via composer:
composer require --prefer-dist mirko-pagliai/cakephp-database-backup
Then you have to load the plugin. For more information on how to load the plugin, please refer to the CakePHP documentation.
You can execute the shell command to enable the plugin:
bin/cake plugin load DatabaseBackup
This would update your application's bootstrap method.
Installation on older CakePHP and PHP versions
Compared to the current installation requirements, some tags or branches are provided for those using older versions of CakePHP and PHP:
2.15versions, which require at least CakePHP5.0and PHP8.1;- tag
cakephp4, which requires at least PHP>=7.4.0and CakePHP^4.0.
This tag no longer receives any updates as of January 5, 2024, and roughly coincides with what2.12.3version was. - tag
cakephp3, which requires at least PHP>=5.6 <7.4and CakePHP^3.5.1.
This tag no longer receives any updates as of April 29, 2021, and roughly coincides with what2.8.5version was.
You can freely use these, even by downloading the source codes from the attached assets, but their functioning is no longer guaranteed, especially regarding old dependencies that may no longer be available.
Configuration and How to use
See our documentation.
Before opening an issue, check this list of common issues.
Testing
Unlike previous versions, with the 3.x branch, thanks to the Mockery's overloading and the (external) component
Process that actually takes care of executing the commands to export/import the databases, normally the tests do not
really use the database drivers and do not write or read files on the filesystem (i.e., everything is simulated).
The only exception is given by the class DatabaseBackup\Test\TestCase\Utility\BackupExportAndImportTest, which however
does not belong to the testsuite executed by default (it is therefore an optional test) and is marked with the attribute
#[CoversNothing].
This test class, when executed, will test a real database export and import, using the pdo_mysql, pdo_pgsql and
pdo_sqlite PHP extensions, that is all the drivers and databases supported by the plugin.
You can test the class directly or the configured real-drivers testsuite (see available testsuites):
vendor/bin/phpunit --testsuite=real-drivers
Continuous integration (CI) workflows must be run with highest/lowest dependencies and "without"/"only with"
real drivers and databases.
Running tests with real database drivers (Docker)
Some tests require real database drivers and system binaries (e.g. mysqldump, pg_dump, pg_restore) and therefore
depend on the local environment configuration.
However, running these tests reliably requires properly configured database servers and matching system binaries.
For this reason, Docker can be used to provide a predefined and controlled environment in which real-drivers tests can be executed consistently.
Running real-drivers tests using Docker
From the project root:
docker compose -f docker/docker-compose.yml down -v
docker compose -f docker/docker-compose.yml build
docker compose -f docker/docker-compose.yml up -d
docker compose -f docker/docker-compose.yml exec php vendor/bin/phpunit --testsuite=real-drivers
This setup runs the real-drivers test suite against real MySQL/MariaDB and PostgreSQL servers, using their corresponding dump/restore binaries, in a controlled environment.
Versioning
For transparency and insight into our release cycle and to maintain backward compatibility, DatabaseBackup will be maintained under the Semantic Versioning guidelines.
mirko-pagliai/cakephp-database-backup 适用场景与选型建议
mirko-pagliai/cakephp-database-backup 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 27.21k 次下载、GitHub Stars 达 24, 最近一次更新时间为 2017 年 06 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mirko-pagliai/cakephp-database-backup 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mirko-pagliai/cakephp-database-backup 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 27.21k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 24
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-06-23