shegroup / download-bundle
此包提供用于symfony2的下载工具
1.2.0
2023-01-17 15:14 UTC
Requires
- php: >=7.0
- desarrolla2/timer: ^0.3
- symfony/framework-bundle: ^2.8 || ^3.0 || ^4.0
Requires (Dev)
- escapestudios/symfony2-coding-standard: 3.x-dev
- friendsofphp/php-cs-fixer: ^2.5
- mmoreram/php-formatter: ^1.1
- phpmd/phpmd: ^2.6
- squizlabs/php_codesniffer: ^3.0
This package is auto-updated.
Last update: 2024-09-14 16:03:22 UTC
README
此包允许您从远程主机将数据库和相关文件夹下载到本地机器。这是在开发环境中拥有相同生产数据的最容易和最简单的方法。
该包通过ssh连接工作,因此您需要配置通过公钥连接。
免责声明:此包仅在具有linux环境的系统中工作。
安装
下载包
composer require --dev "SheGroup/download-bundle"
启用包
// app/AppKernel.php // ... class AppKernel extends Kernel { public function registerBundles() { // enable it only for dev environment if (in_array($this->getEnvironment(), ['dev'], true)) { $bundles[] = new SheGroup\DownloadBundle\DownloadBundle(); } // ... } // ... }
配置
您需要在config_dev.yml中添加类似以下内容:
download: user: 'deploy_user' host: 'production_host_or_ip' port: 22 # optional parameter. use it if you want customize max proccess time timeout: 300 database: # local directory to save databases directory: '%kernel.root_dir%/../var/data/databases' # optional parameter. use it for tables that you just want to download the structure, not data only_structure: - 'mail_history' remote: host: 'production_database_host' name: 'production_database_name' user: 'production_database_user' password: 'production_database_password' local: host: '%database_host%' name: '%database_name%' user: '%database_user%' password: '%database_password%' # optional parameter. define max number of database files to keep on local directory max_local_db: 0 # some directories that you want download. directories: web_uploads: remote: '/path/to/project/web/uploads' local: '%kernel.root_dir%/../web' # you can exclude some directories from there exclude: - 'cache' var_data: remote: '/path/to/project/var/data' local: '%kernel.root_dir%/../var' exclude: - 'spool'
使用
下载
当您执行此命令时,数据库和目录将从远程环境下载。
php bin/console downloader:download
这是您将在命令行中看到的内容。
加载
也许您想将本地数据库恢复到之前的状态。此包会保留您每次下载的副本,因此轻松回到这些状态之一。
php bin/console downloader:load
从可用日期中选择。
这是您将在命令行中看到的内容。
删除旧数据库
从本地目录删除旧数据库。您可以保留的最大文件数由max_local_db参数定义。
php bin/console downloader:delete:old
联系
您可以通过@desarrolla2与我联系。