2017 © Pedro Peláez
 

yii2-extension yii2-db-manager

The db dump manager module for Yii2

image

beaten-sect0r/yii2-db-manager

The db dump manager module for Yii2

  • Tuesday, May 8, 2018
  • by Beaten_Sect0r
  • Repository
  • 4 Watchers
  • 50 Stars
  • 3,185 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 11 Forks
  • 3 Open issues
  • 10 Versions
  • 10 % Grown

The README.md

Yii2 DB manager

Click on a :star:!, (*1)

Total Downloads Latest Stable Version Latest Unstable Version License, (*2)

MySQL/PostgreSQL Database Backup and Restore functionality, (*3)

screenshot, (*4)

Installation

The preferred way to install this extension is through composer., (*5)

Either run, (*6)

composer require --prefer-dist beaten-sect0r/yii2-db-manager "*"

or add, (*7)

"beaten-sect0r/yii2-db-manager": "*"

to the require section of your composer.json file., (*8)

Configuration

Once the extension is installed, simply add it in your config by:, (*9)

Basic config/web.php, (*10)

Advanced backend/config/main.php, (*11)

Simple config

    'modules' => [
        'db-manager' => [
            'class' => 'bs\dbManager\Module',
            // path to directory for the dumps
            'path' => '@app/backups',
            // list of registerd db-components
            'dbList' => ['db'],
            // Flysystem adapter (optional) creocoder\flysystem\LocalFilesystem will be used as default. 
            'flySystemDriver' => 'creocoder\flysystem\LocalFilesystem',
            'as access' => [
                'class' => 'yii\filters\AccessControl',
                'rules' => [
                    [
                        'allow' => true,
                        'roles' => ['admin'],
                    ],
                ],
            ],
        ],
    ],

Advanced config

    'components' => [
        // https://github.com/creocoder/yii2-flysystem
        'backupStorage' => [
            'class' => 'creocoder\flysystem\FtpFilesystem',
            'host' => 'ftp.example.com',
            //'port' => 21,
            //'username' => 'your-username',
            //'password' => 'your-password',
            //'ssl' => true,
            //'timeout' => 60,
            //'root' => '/path/to/root',
            //'permPrivate' => 0700,
            //'permPublic' => 0744,
            //'passive' => false,
            //'transferMode' => FTP_TEXT,
        ],
    ],
    'modules' => [
        'db-manager' => [
            'class' => 'bs\dbManager\Module',
            // Flysystem adapter (optional) creocoder\flysystem\LocalFilesystem will be used as default. 
            'flySystemDriver' => 'creocoder\flysystem\LocalFilesystem',
            // path to directory for the dumps
            'path' => '@app/backups',
            // list of registerd db-components
            'dbList' => ['db', 'db1', 'db2'],
            // process timeout
            'timeout' => 3600,
            // additional mysqldump/pg_dump presets (available for choosing in dump and restore forms)
            'customDumpOptions' => [
                'mysqlForce' => '--force',
                'somepreset' => '--triggers --single-transaction',
                'pgCompress' => '-Z2 -Fc',
            ],
            'customRestoreOptions' => [
                'mysqlForce' => '--force',
                'pgForce' => '-f -d',
            ],
            // options for full customizing default command generation
            'mysqlManagerClass' => 'CustomClass',
            'postgresManagerClass' => 'CustomClass',
            // option for add additional DumpManagers
            'createManagerCallback' => function($dbInfo) {
                if ($dbInfo['dbName'] == 'exclusive') {
                    return new MyExclusiveManager;
                } else {
                    return false;
                }
            }
            'as access' => [
                'class' => 'yii\filters\AccessControl',
                'rules' => [
                    [
                        'allow' => true,
                        'roles' => ['admin'],
                    ],
                ],
            ],
        ],
    ],

Console config

    'modules' => [
        'db-manager' => [
            'class' => 'bs\dbManager\Module',
            // Flysystem adapter (optional) creocoder\flysystem\LocalFilesystem will be used as default. 
            'flySystemDriver' => 'creocoder\flysystem\LocalFilesystem',
            // path to directory for the dumps
            'path' => '@app/backups',
            // list of registerd db-components
            'dbList' => ['db'],
        ],
    ],

Make sure you create a writable directory named backup on app root directory., (*12)

Usage

Pretty url's /db-manager, (*13)

No pretty url's index.php?r=db-manager, (*14)

Console usage

-db - db component, default value: db, (*15)

-gz - gzip archive, (*16)

-s - file storage, (*17)

-f - file name, default last dump, (*18)

Create dump, (*19)

php yii dump/create -db=db -gz -s

Restore dump, (*20)

php yii dump/restore -db=db -s -f=dump.sql

Deleting all dumps, (*21)

php yii dump/delete-all

Test database connection, (*22)

php yii dump/test-connection -db=db

Changelog

  • Flysystem support
  • Console support
  • Multiple database management
  • Ability for customize dump and restore options; dump and restore processors
  • Ability for run operations asynchronously
  • Ability for compressing dumps

The Versions

08/05 2018

dev-master

9999999-dev

The db dump manager module for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar Insolita

yii2 backup dump db manager

08/05 2018

2.0.3

2.0.3.0

The db dump manager module for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar Insolita

yii2 backup dump db manager

08/05 2018

2.1.0

2.1.0.0

The db dump manager module for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar Insolita

yii2 backup dump db manager

26/04 2018

2.0.2

2.0.2.0

The db dump manager module for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar Insolita

yii2 backup dump db manager

01/09 2017

2.0.1

2.0.1.0

The db dump manager module for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar Insolita

yii2 backup dump db manager

09/07 2017

2.0.0

2.0.0.0

The db dump manager module for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar Insolita

yii2 backup dump db manager

25/02 2017

1.0.3

1.0.3.0

The db dump manager module for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar Insolita

yii2 backup dump db manager

11/12 2016

1.0.2

1.0.2.0

The db dump manager module for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar Insolita

yii2 backup dump db manager

30/07 2016

1.0.1

1.0.1.0

The db dump manager module for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar Insolita

yii2 backup dump db manager

04/06 2016

1.0.0

1.0.0.0

The db dump manager module for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar Insolita

yii2 backup dump db manager