https://github.com/zewa666/redbean_mysqlbackup
Mysql Backup Plugin for RedBean ORM
https://github.com/zewa666/redbean_mysqlbackup
Last synced: 5 months ago
JSON representation
Mysql Backup Plugin for RedBean ORM
- Host: GitHub
- URL: https://github.com/zewa666/redbean_mysqlbackup
- Owner: zewa666
- License: other
- Created: 2013-10-14T11:49:34.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-02-26T19:11:26.000Z (over 11 years ago)
- Last Synced: 2024-11-15T08:28:17.174Z (7 months ago)
- Language: PHP
- Size: 203 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license.txt
Awesome Lists containing this project
README
RedBean_MysqlBackup
=======================This is a plugin for the [RedBeanPHP ORM](http://www.redbeanphp.com/), which
will create Backup files for a MySql DB Server. This module explicitly only supports MySql
and will throw an Exception if used with another DSN.The backup file is created by using RedBeans connected DSN information along-side
queries against the database to get the schema and values.!IMPORTANT!
This module will only export tables and nothing else.
If you need something more sophisticated I'd recommend using the [mysqldump script](http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html)
provided by MySql itself.
The idea of this script is to quickly get a backups of the structure+data solely.
So to make it clear:This plugin will not export:
- Triggers
- Views
- Stored Procedures
- UDF's
- etc.really only Tables :)
!PRODUCTION USE NOTICE!
I'm not going to garantuee for anything, so please don't rely 100% on this code before
testing it on your own Database. At least for me it works :)Preqrequisites:
=======================
- PHP >= 5.3
- Mysql >= whatever version
- RedBean >= 3.5 (there is a dependency on the Dynamic Plugin R::ext() method)Usage:
=======================Usage is quite simply since the use of R::ext() in RedBean 3.5.
- Create the folder where you'd like to have the backup-files created in manually.
- Set permissions on folder to allow php to create files in it
- Execute your desired way of backup-creation (see code below)```php
// create backup-file with auto name into folder backup
R::performMysqlBackup("backup");// create custom named backup-file into folder backup
R::performMysqlBackup("backup", "MyFullBackup.sql");
```Example:
=======================Take a look at the included example.php. The RedBean verion in this repo is the all-in-one build 3.5