Fix: Path to postgresql dump

This commit is contained in:
Laurent Destailleur 2011-01-10 01:08:40 +00:00
parent 811fb69e99
commit 8ed281ceea

View File

@ -1206,12 +1206,18 @@ class DoliDb
/** /**
* \brief Return full path of dump program * \brief Return full path of dump program
* \return string Full path of dump program * \return string Full path of dump program
* TODO L'utilisateur de la base doit etre un superadmin pour lancer cette commande
*/ */
function getPathOfDump() function getPathOfDump()
{ {
$fullpathofdump='/pathtopgdump/pg_dump'; $fullpathofdump='/pathtopgdump/pg_dump';
if (file_exists('/usr/bin/pg_dump'))
{
$fullpathofdump='/usr/bin/pg_dump';
}
else
{
// TODO L'utilisateur de la base doit etre un superadmin pour lancer cette commande
$resql=$this->query('SHOW data_directory'); $resql=$this->query('SHOW data_directory');
if ($resql) if ($resql)
{ {
@ -1219,6 +1225,7 @@ class DoliDb
$basedir=$liste['data_directory']; $basedir=$liste['data_directory'];
$fullpathofdump=preg_replace('/data$/','bin',$basedir).'/pg_dump'; $fullpathofdump=preg_replace('/data$/','bin',$basedir).'/pg_dump';
} }
}
return $fullpathofdump; return $fullpathofdump;
} }