mirko-pagliai/cakephp-database-backup 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mirko-pagliai/cakephp-database-backup

Composer 安装命令:

composer require mirko-pagliai/cakephp-database-backup

包简介

Database Backup plugin for CakePHP

README 文档

README

Software License CI codecov Codacy Badge CodeFactor

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.

Make a donation

Requirements

DatabaseBackup requires:

  • mariadb and mariadb-dump for MariaDB/MySql databases (if you still use mysql/mysqldump, see here);
  • pg_dump and pg_restore for Postgres databases;
  • sqlite3 for 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.15 versions, which require at least CakePHP 5.0 and PHP 8.1;
  • tag cakephp4, which requires at least PHP >=7.4.0 and CakePHP ^4.0.
    This tag no longer receives any updates as of January 5, 2024, and roughly coincides with what 2.12.3 version was.
  • tag cakephp3, which requires at least PHP >=5.6 <7.4 and CakePHP ^3.5.1.
    This tag no longer receives any updates as of April 29, 2021, and roughly coincides with what 2.8.5 version 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 我们能提供哪些服务?
定制开发 / 二次开发

基于 mirko-pagliai/cakephp-database-backup 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 27.21k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 24
  • 点击次数: 13
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 24
  • Watchers: 3
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-06-23