Русская документация доступна на сайте OpenItStudio, (*1)
Yii2 Backup and Restore Database
Database Backup and Restore functionality, (*2)
Installation
The preferred way to install this extension is through composer., (*3)
Either run, (*4)
php composer.phar require --prefer-dist fgh151/yii2-backup "*"
or add, (*5)
"fgh151/yii2-backup": "*"
to the require section of your composer.json
file., (*6)
Usage
Once the extension is installed, simply add it in your config by :, (*7)
Basic config/web.php
, (*8)
Advanced [backend|frontend|common]/config/main.php
, (*9)
'modules' => [
'backup' => [
'class' => 'fgh151\modules\backup\Module',
],
...
...
],
Console
php
'bootstrap' => ['backup'],
'modules' => [
'backup' => [
'class' => 'fgh151\modules\backup\Module',
'path' => '@backend/_backup/' //path alias of backup dir
]
],
, (*10)
make sure you create a writable directory named _backup on app root directory., (*11)
RBAC
You can use RBAC with module. Simply add it in your config:, (*12)
'modules' => [
'backup' => [
'class' => 'fgh151\modules\backup\Module',
'as access' => [
'class' => 'yii\filters\AccessControl',
'rules' => [
[
'allow' => true,
'roles' => ['admin'],
]
]
]
]
...
...
],
Usage
Pretty Url's /backup
, (*13)
No pretty Url's index.php?r=backup
, (*14)
Console yii backup/backup
, (*15)