From c37be2810d2955076de747f3aaba58ac56176b4f Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Fri, 21 Jun 2013 01:41:54 +0300 Subject: [PATCH] dbdump command --- ipf/cli.php | 3 ++- ipf/command/dbdump.php | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 ipf/command/dbdump.php diff --git a/ipf/cli.php b/ipf/cli.php index eff7869..39b97ba 100644 --- a/ipf/cli.php +++ b/ipf/cli.php @@ -12,9 +12,10 @@ class IPF_Cli new IPF_Command_BuildModels, new IPF_Command_BuildContribModels, new IPF_Command_Sql, - new IPF_Command_DB, new IPF_Command_SyncDB, new IPF_Command_Fixtures, + new IPF_Command_DB, + new IPF_Command_DBDump, new IPF_Command_CreateSuperUser, new IPF_Command_SyncPerms, ); diff --git a/ipf/command/dbdump.php b/ipf/command/dbdump.php new file mode 100644 index 0000000..2072389 --- /dev/null +++ b/ipf/command/dbdump.php @@ -0,0 +1,28 @@ +connectionParameters(IPF::get('database', IPF::get('dsn'))); + + if ($db['scheme'] === 'mysql') { + IPF_Shell::call('mysqldump', + '-h'.$db['host'], + '-u'.$db['username'], + '-p'.$db['password'], + '-r'.$output, + $db['database']); + } else { + print 'Do not know how to connect to "'.$db['scheme'].'" database.'; + } + } +} + -- 2.49.0