make dumps and backups with php
by
Wyden Silvan
—
last modified
05.03.2011 11:10
<?php
$dump_file = 'dump.sql';
$db_user = 'openerp';
$db_pass = 'MYPASSWORD';
$db_dbname = 'reservation2';
$db_host = 'localhost';
putenv('PGPASSWORD=' . $db_pass);
putenv('PGUSER=' . $db_user);
putenv('PGHOST=' . $db_host);
//make backup of a database with pg_dump
//system('pg_dump '.$db_dbname.' > '.$dump_file);
//create new databse $db_dbname
system('createdb ' . $db_dbname);
//copy template into new databse
system('psql -f openerp_template.sql -d ' . $db_dbname);
?>
~
