Fix: Wrong path of mysqldump command. Another try to fix this.

This commit is contained in:
Laurent Destailleur 2009-11-29 19:32:16 +00:00
parent afebd7c1cf
commit 6596e42118
6 changed files with 137 additions and 29 deletions

View File

@ -77,7 +77,7 @@ if ($db->label == 'MySQL')
{
?>
document.getElementById("mysql_options").style.display = 'none';
<?php
<?php
}
?>
<?php
@ -85,7 +85,7 @@ if ($db->label == 'PostgreSQL')
{
?>
document.getElementById("postgresql_options").style.display = 'none';
<?php
<?php
}
?>
}
@ -175,17 +175,7 @@ if ($db->label == 'MySQL')
<?php echo $langs->trans("FullPathToMysqldumpCommand");
if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP))
{
$resql=$db->query('SHOW VARIABLES LIKE \'basedir\'');
if ($resql)
{
$liste=$db->fetch_array($resql);
$basedir=$liste['Value'];
$fullpathofmysqldump=$basedir.'bin/mysqldump';
}
else
{
$fullpathofmysqldump='/pathtomysqldump/mysqldump';
}
$fullpathofmysqldump=$db->getPathOfDump();
}
else
{
@ -298,7 +288,7 @@ if ($db->label == 'MySQL')
</fieldset>
</fieldset>
<?php
<?php
}
if ($db->label == 'PostgreSQL')
@ -312,17 +302,7 @@ if ($db->label == 'PostgreSQL')
<?php echo $langs->trans("FullPathToPostgreSQLdumpCommand");
if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP))
{
$resql=$db->query('SHOW data_directory');
if ($resql)
{
$liste=$db->fetch_array($resql);
$basedir=$liste['data_directory'];
$fullpathofpgdump=preg_replace('/data$/','bin',$basedir).'/pg_dump';
}
else
{
$fullpathofpgdump='/pathtopgdump/pg_dump';
}
$fullpathofpgdump=$db->getPathOfDump();
}
else
{
@ -383,7 +363,7 @@ if ($db->label == 'PostgreSQL')
</fieldset>
</fieldset>
<?php
<?php
}
?>

View File

@ -94,12 +94,16 @@ print '<br>';
<div id="div_container_sub_exportoptions">
<?php
if ($db->label == 'MySQL')
{
?>
<fieldset id="mysql_options">
<legend>Import MySql</legend>
<div class="formelementrow">
<?php
// Parameteres execution
$command='mysql';
$command=$db->getPathOfRestore();
if (preg_match("/\s/",$command)) $command=$command=escapeshellarg($command); // Use quotes on command
$param=$dolibarr_main_db_name;
@ -122,6 +126,9 @@ print '<br>';
//else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&amp;radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>';
?>
</div>
<?php
}
?>
<script type="text/javascript" language="javascript">
//<![CDATA[

View File

@ -961,7 +961,8 @@ class DoliDb
return ''; // attente d<>buggage
}
function getDefaultCollationDatabase(){
function getDefaultCollationDatabase()
{
$resql=$this->query("SELECT SERVERPROPERTY('collation')");
if (!$resql)
{
@ -971,7 +972,8 @@ class DoliDb
return $liste['computed'];
}
function getListOfCollation(){
function getListOfCollation()
{
/*
$resql=$this->query('SHOW COLLATION');
$liste = array();
@ -992,6 +994,15 @@ class DoliDb
return ''; // attente debugage
}
function getPathOfDump()
{
}
function getPathOfRestore()
{
}
}
?>

View File

@ -1097,6 +1097,42 @@ class DoliDb
return $liste;
}
/**
* \brief Return full path of dump program
* \return string Full path of dump program
*/
function getPathOfDump()
{
$fullpathofdump='/pathtomysqldump/mysqldump';
$resql=$this->query('SHOW VARIABLES LIKE \'basedir\'');
if ($resql)
{
$liste=$this->fetch_array($resql);
$basedir=$liste['Value'];
$fullpathofdump=$basedir.'bin/mysqldump';
}
return $fullpathofdump;
}
/**
* \brief Return full path of restore program
* \return string Full path of restore program
*/
function getPathOfRestore()
{
$fullpathofimport='/pathtomysql/mysql';
$resql=$this->query('SHOW VARIABLES LIKE \'basedir\'');
if ($resql)
{
$liste=$this->fetch_array($resql);
$basedir=$liste['Value'];
$fullpathofimport=$basedir.'bin/mysql';
}
return $fullpathofimport;
}
}
?>

View File

@ -1109,6 +1109,43 @@ class DoliDb
}
return $liste;
}
/**
* \brief Return full path of dump program
* \return string Full path of dump program
*/
function getPathOfDump()
{
$fullpathofdump='/pathtomysqldump/mysqldump';
$resql=$this->query('SHOW VARIABLES LIKE \'basedir\'');
if ($resql)
{
$liste=$this->fetch_array($resql);
$basedir=$liste['Value'];
$fullpathofdump=$basedir.'bin/mysqldump';
}
return $fullpathofdump;
}
/**
* \brief Return full path of restore program
* \return string Full path of restore program
*/
function getPathOfRestore()
{
$fullpathofimport='/pathtomysql/mysql';
$resql=$this->query('SHOW VARIABLES LIKE \'basedir\'');
if ($resql)
{
$liste=$this->fetch_array($resql);
$basedir=$liste['Value'];
$fullpathofimport=$basedir.'bin/mysql';
}
return $fullpathofimport;
}
}
?>

View File

@ -1038,5 +1038,42 @@ class DoliDb
return $liste;
}
/**
* \brief Return full path of dump program
* \return string Full path of dump program
*/
function getPathOfDump()
{
$fullpathofdump='/pathtopgdump/pg_dump';
$resql=$db->query('SHOW data_directory');
if ($resql)
{
$liste=$db->fetch_array($resql);
$basedir=$liste['data_directory'];
$fullpathofdump=preg_replace('/data$/','bin',$basedir).'/pg_dump';
}
return $fullpathofdump;
}
/**
* \brief Return full path of restore program
* \return string Full path of restore program
*/
function getPathOfRestore()
{
$fullpathofmysqldump='/pathtomysql/mysql';
$resql=$this->query('SHOW VARIABLES LIKE \'basedir\'');
if ($resql)
{
$liste=$this->fetch_array($resql);
$basedir=$liste['Value'];
$fullpathofmysqldump=$basedir.'bin/mysql';
}
return $fullpathofmysqldump;
}
}
?>