定制 shegroup/download-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

shegroup/download-bundle

最新稳定版本:1.2.0

Composer 安装命令:

composer require shegroup/download-bundle

包简介

This bundle provides download utilities for symfony2

README 文档

README

This bundle allows you to download a database and folders associated with the project from remote host to local machine. It is the easiest and easiest way to have the same production data in your development environment.

The bundle works using ssh connections so it is necessary that you have configured to connect through a public key.

Disclaimer: This bundle works only for environments with linux.

Installation

Download the Bundle.

composer require --dev "SheGroup/download-bundle"

Enable the 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();
        }

        // ...
    }

    // ...
}

Configuration

You need put something like this in your 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'            
            

Usage

Download

When you execute this command, both the database and the directories are downloaded from the remote environment.

php bin/console downloader:download

This is what you will see in your command line.

screenshot

Load

Maybe you want to put your local database in a previous state. This bundle keeps a copy of every download you have made, so going back to one of these states is very easy.

php bin/console downloader:load

Select from available dates.

screenshot

This is what you will see in your command line.

screenshot

Delete old databases

Delete old databases from the local directory. The max number of files you can keep is defined by max_local_db parameter

php bin/console downloader:delete:old

Contact

You can contact with me on @desarrolla2.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-17