如何回滚数据库,媒体,代码
转到Magento管理员根文件夹并显示用法:
php bin/magento setup:rollback --help
Usage:
setup:rollback [options]
Options:
-c, --code-file=CODE-FILE Basename of the code backup file in var/backups
-m, --media-file=MEDIA-FILE Basename of the media backup file in var/backups
-d, --db-file=DB-FILE Basename of the db backup file in var/backups
--magento-init-params=MAGENTO-INIT-PARAMS Add to any command to customize Magento initialization parameters
For example: "MAGE_MODE=developer&MAGE_DIRS[base][path]=/var/www/example.com&MAGE_DIRS[cache][path]=/var/tmp/cache"
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
Rolls back Magento Application codebase, media and database
在此示例中,我将向您展示如何还原/回滚Magento数据库。回滚之前,请检查是否存在备份文件:
列出所有存在的备份文件
php bin/magento info:backups:list
输出:
Showing backup files in ./var/backups.
+---------------------------------+-------------+
| Backup Filename | Backup Type |
+---------------------------------+-------------+
| 1534245793_db.sql | db |
| 1534245893_filesystem_media.tgz | media |
+---------------------------------+-------------+
让我们回滚数据库
php bin/magento setup:rollback --db-file=1534245793_db.sql
它要求确认,键入:y
进行回滚过程。
输出:
Enabling maintenance mode
You are about to remove current code and/or database tables. Are you sure?[y/N]y
DB rollback is starting...
DB rollback filename: 1534245793_db.sql
DB rollback path: /var/www/html/sam/ce2252/var/backups/1534245793_db.sql
[SUCCESS]: DB rollback completed successfully.
Please set file permission of bin/magento to executable
Disabling maintenance mode
注意
所有备份文件都必须放在./var/backups/
文件夹中。
回滚媒体,代码
与回滚/恢复数据库相同。运行以下命令行:
回滚媒体
php bin/magento setup:rollback --media-file=your-filesystem_media.tgz
回滚代码
php bin/magento setup:rollback --code-file=your-filesystem_code.tgz