Hi there everyone!
I would like to use this script to backup my site's db's so my automated file backup solution will download them along with the files.
https://github.com/daniloaz/myphp-backup
So the magic bits are:
define("DB_USER", 'your_username');
define("DB_PASSWORD", 'your_password');
define("DB_NAME", 'your_db_name');
$backupDatabase = new Backup_Database(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, CHARSET);
$result = $backupDatabase->backupTables(TABLES, BACKUP_DIR) ? 'OK' : 'KO';
$backupDatabase->obfPrint('Backup result: ' . $result, 1);
// Use $output variable for further processing, for example to send it by email
$output = $backupDatabase->getOutput();
My thinking is that I need to make the db credentials an array and I need to convert the last bit to work through it. The issue I have is that sometimes, there will be multiple DB names attached to the same user, so I need to set that up as a subarray of some sort.
{
User: bob
pass: password
db names: cats, dogs, dolphins
}
{
User: john
pass: 11111
db names: bikes, cars, boats
}
{
User: jane
pass: 123456
db names: pizza
}
But I'm having problems figuring out how to convert this script to work through all available databases. Any help on doing this would be greatly appreciated.
Thanks for your time!