Diem plugins syndication

dmSqlBackupPlugin

Creates SQL backups for your project

dmSqlBackupPlugin allows to create SQL backups for your project.
It provides the sql_backup service, and a dm:sql-backup task.
Fully configurable and extensible with new database adapters.
Currently, only a Mysql adapter is available.

Installation

  • In a console, from your project root dir, run:
git clone git://github.com/ornicar/dmSqlBackupPlugin.git plugins/dmSqlBackupPlugin  
  • In config/ProjectConfiguration.class.php, add dmSqlBackupPlugin to the list of enabled plugins:
class ProjectConfiguration extends dmProjectConfiguration
{  
  public function setup()  
  {  
    parent::setup();  
 
    $this->enablePlugins(array(  
      // your enabled plugins  
      'dmSqlBackupPlugin'  
    ));  
  • In a console, from your project root dir, run:
php symfony dm:setup  

Usage

Command line

php symfony dm:sql-backup  

Plan a cron task

For example to run this task all days:
/etc/crontab

@daily www-data /usr/bin/php5 /home/my-project/symfony dm:sql-backup  

Programmatically

$sqlBackup = $this->getService('sql_backup');
$sqlBackup->execute($connection);  

$connection must be an instance of Doctrine_Connection.

Customize

Use the service container configuration file to change sql_backup parameters. It allows to configure the service, add new adapters and override the service class.
config/dm/services.yml

parameters:  
  
  sql_backup.class:       dmSqlBackup  
  sql_backup.adapters:  
    mysql:                dmSqlBackupAdapterMysql  
  sql_backup.options:  
    dir:                  SF_ROOT_DIR/data/dm/backup/sql  
    file_format:          %%db_name%%-%%year%%_%%month%%_%%day%%_%%time%%.sql  
  • Loban Amaan RahmanMarch 11, 2010 4:30 AM

    I've got a couple of suggestions that would make this plugin perfect:

    (1) Add a dm:sql-restore task. I guess it can take which backup to use as an argument.

    (2) Add a menu item + UI in the admin panel to take, list, and restore backups.

    Love the work you've done Thibault D!

  • tario gameOctober 10, 2011 12:42 PM

    Great information. It's really useful. Thanks

  • wedding dressesNovember 10, 2012 12:50 AM

    I like to read diem-project.org often, keep doing fine work ! [url=http://www.youtube.com/watch?v=Ceh9uYyMh2A]wedding dresses[/url]
    cakes for your wedding
    [url=http://www.youtube.com/watch?v=dVrUsVugglE]wedding cakes[/url]
    songs for your wedding
    [url=http://www.youtube.com/watch?v=qzdX-xAo61E]wedding songs[/url]
    perfect bridal makeup tutorial
    [url=http://www.youtube.com/watch?v=DIW1Vh4UkgU]bridal makeup[/url]

  • makeupNovember 14, 2012 1:22 AM

    I'm glad that i found diem-project.org
    [url=http://www.youtube.com/watch?v=JNwJiGp345c]makeup tutorial[/url]
    [url=http://www.youtube.com/watch?v=3HbmMGaTE_A]helloween makeup tutorial[/url]
    [url=http://www.youtube.com/watch?v=-CPdQHqSEjM]smokey eye tutorial[/url]

  • htcNovember 15, 2012 6:09 AM

    Thank you very much for that big article

  • GarsFebruary 20, 2013 7:55 AM

    Fatal error: Class 'dmContextTask' not found in C:\dev\serveranime\system\plugin
    s\dmSqlBackupPlugin\lib\task\dmSqlBackupTask.class.php on line 3

Add a comment

Create an issue
Impossible to fetch issues for this plugin.
Impossible to get this plugin changelog.
See more commits

dmSqlBackupPlugin, created on March 3, 2010 by Thibault D, used by 582 projects

Fork Diem on GitHub