Yii2 DB manager ¶
https://github.com/Beaten-Sect0r/yii2-db-manager
Database Backup and Restore functionality
Installation ¶
The preferred way to install this extension is through composer.
Either run
composer require --prefer-dist beaten-sect0r/yii2-db-manager "*"
or add
"beaten-sect0r/yii2-db-manager": "*"
to the require section of your composer.json
file.
Configuration ¶
Once the extension is installed, simply add it in your config by:
Basic `
config/web.php`
Advanced `
backend/config/main.php`
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'],
'as access' => [
'class' => 'yii\filters\AccessControl',
'rules' => [
[
'allow' => true,
'roles' => ['admin'],
],
],
],
],
Advanced config ¶
'modules' => [
'db-manager' => [
'class' => 'bs\dbManager\Module',
// path to directory for the dumps
'path' => '@app/backups',
// list of registerd db-components
'dbList' => ['db', 'db1', 'db2'],
// 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'],
],
],
],
],
Make sure you create a writable directory named backup on app root directory.
Usage ¶
Pretty url's `
/db-manager`
No pretty url's `
index.php?r=db-manager`
Changelog: ¶
- Multiple database management
- Ability for customize dump and restore options; dump and restore processors
- Ability for run operations asynchronously
- Ability for compressing dumps
Error line 50
Hi, I have this error at line 50 in beaten-sect0r/yii2-db-manager/Module.php
Error=Undefined offset: 1;
Error line 50
Updated.
Good extension
This extension work very well,but I dont want that access it all people,is there any way to deny access r=db-manager?
GlobalAccessBehavior
alexmetola,
https://github.com/Beaten-Sect0r/yii2-core/blob/master/backend/config/main.php#L56
https://github.com/Beaten-Sect0r/yii2-core/blob/master/common/behaviors/GlobalAccessBehavior.php
Hi,
How could I disable restore option?
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.