2
0
forked from Wavyzz/dolibarr

Fix: Pb in postgresql restore

This commit is contained in:
Laurent Destailleur
2011-01-10 01:40:49 +00:00
parent c0e02fe65e
commit 5f56848a56
5 changed files with 87 additions and 21 deletions

View File

@@ -1236,16 +1236,25 @@ class DoliDb
*/
function getPathOfRestore()
{
$fullpathofmysqldump='/pathtomysql/mysql';
$fullpathofdump='/pathtopgrestore/pg_restore';
$resql=$this->query('SHOW VARIABLES LIKE \'basedir\'');
if ($resql)
{
$liste=$this->fetch_array($resql);
$basedir=$liste['Value'];
$fullpathofmysqldump=$basedir.'bin/mysql';
}
return $fullpathofmysqldump;
if (file_exists('/usr/bin/pg_restore'))
{
$fullpathofdump='/usr/bin/pg_restore';
}
else
{
// TODO L'utilisateur de la base doit etre un superadmin pour lancer cette commande
$resql=$this->query('SHOW data_directory');
if ($resql)
{
$liste=$this->fetch_array($resql);
$basedir=$liste['data_directory'];
$fullpathofdump=preg_replace('/data$/','bin',$basedir).'/pg_restore';
}
}
return $fullpathofdump;
}
/**