Skip to content

Commit

Permalink
Fix: Work with PHP < 5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Dec 28, 2011
1 parent 1aaa1a5 commit d8856ba
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
21 changes: 12 additions & 9 deletions htdocs/admin/tools/dolibarr_export.php
Expand Up @@ -83,6 +83,9 @@ function hideoptions () {
print "\n";
}


$label=getStaticMember($db, 'label');

?>

<!-- Dump of a server -->
Expand All @@ -99,7 +102,7 @@ function hideoptions () {
<div id="div_container_exportoptions">
<fieldset id="exportoptions"><legend><?php echo $langs->trans("ExportMethod"); ?></legend>
<?php
if ($db::$label == 'MySQL')
if ($label == 'MySQL')
{
?>
<div class="formelementrow"><input type="radio" name="what" value="mysql" id="radio_dump_mysql" />
Expand All @@ -112,7 +115,7 @@ function hideoptions () {
<?php
}
}
else if ($db::$label == 'PostgreSQL')
else if ($label == 'PostgreSQL')
{
?>
<div class="formelementrow"><input type="radio" name="what" value="postgresql" id="radio_dump_postgresql" />
Expand All @@ -122,7 +125,7 @@ function hideoptions () {
}
else
{
print 'No method available with database '.$db::$label;
print 'No method available with database '.$label;
}
?>
</fieldset>
Expand All @@ -134,7 +137,7 @@ function hideoptions () {

<div id="div_container_sub_exportoptions">
<?php
if ($db::$label == 'MySQL')
if ($label == 'MySQL')
{
?> <!-- Fieldset mysqldump -->
<fieldset id="mysql_options"><legend><?php echo $langs->trans("MySqlExportParameters"); ?></legend>
Expand Down Expand Up @@ -217,7 +220,7 @@ function hideoptions () {
<?php
}

if ($db::$label == 'PostgreSQL')
if ($label == 'PostgreSQL')
{
?> <!-- Fieldset pg_dump -->
<fieldset id="postgresql_options"><legend><?php echo $langs->trans("PostgreSqlExportParameters"); ?></legend>
Expand Down Expand Up @@ -281,8 +284,8 @@ function hideoptions () {
id="filename_template"
value="<?php
$prefix='dump';
if ($db::$label == 'MySQL') $prefix='mysqldump';
if ($db::$label == 'PostgreSQL') $prefix='pg_dump';
if ($label == 'MySQL') $prefix='mysqldump';
if ($label == 'PostgreSQL') $prefix='pg_dump';
$file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.sql';
echo $file;
?>" /> <br>
Expand All @@ -296,7 +299,7 @@ function hideoptions () {
// 'zip' => array('function' => 'zip_open', 'id' => 'radio_compression_zip', 'label' => $langs->trans("Zip")), Not open source
'gz' => array('function' => 'gzopen', 'id' => 'radio_compression_gzip', 'label' => $langs->trans("Gzip")),
);
if ($db::$label == 'MySQL')
if ($label == 'MySQL')
{
$compression['bz']=array('function' => 'bzopen', 'id' => 'radio_compression_bzip', 'label' => $langs->trans("Bzip2"));
}
Expand Down Expand Up @@ -339,10 +342,10 @@ function hideoptions () {
</form>

<?php

$result=$formfile->show_documents('systemtools','backup',$conf->admin->dir_output.'/backup',$_SERVER['PHP_SELF'],0,1,'',1,0,0,54,0,'',$langs->trans("PreviousDumpFiles"));
//if ($result) print '<br><br>';

llxFooter();

$db->close();
?>
15 changes: 8 additions & 7 deletions htdocs/admin/tools/dolibarr_import.php
Expand Up @@ -58,6 +58,8 @@
print $langs->trans("RestoreDesc2",DOL_DATA_ROOT).'<br><br>';
print $langs->trans("RestoreDesc3",DOL_DATA_ROOT).'<br><br>';

$label=getStaticMember($db, 'label');

?>

<fieldset id="fieldsetexport">
Expand All @@ -69,7 +71,7 @@
<fieldset id="exportoptions">
<legend><?php echo $langs->trans("ImportMethod"); ?></legend>
<?php
if ($db::$label == 'MySQL')
if ($label == 'MySQL')
{
?>
<div class="formelementrow">
Expand All @@ -78,7 +80,7 @@
</div>
<?php
}
else if ($db::$label == 'PostgreSQL')
else if ($label == 'PostgreSQL')
{
?>
<div class="formelementrow">
Expand All @@ -89,7 +91,7 @@
}
else
{
print 'No method available with database '.$db::$label;
print 'No method available with database '.$label;
}
?>
</fieldset>
Expand All @@ -101,7 +103,7 @@

<div id="div_container_sub_exportoptions">
<?php
if ($db::$label == 'MySQL')
if ($label == 'MySQL')
{
?>
<fieldset id="mysql_options">
Expand Down Expand Up @@ -135,7 +137,7 @@
</fieldset>
<?php
}
else if ($db::$label == 'PostgreSQL')
else if ($label == 'PostgreSQL')
{
?>
<fieldset id="postgresql_options">
Expand Down Expand Up @@ -180,8 +182,7 @@
</fieldset>

<?php
llxFooter();

$db->close();

llxFooter();
?>
2 changes: 1 addition & 1 deletion htdocs/admin/tools/export.php
Expand Up @@ -394,7 +394,7 @@ function backup_tables($outputfile, $tables='*')

// Print headers and global mysql config vars
$sqlhead = '';
$sqlhead .= "-- ".$db::$label." dump via php
$sqlhead .= "-- ".getStaticMember($db, 'label')." dump via php
--
-- Host: ".$db->db->host_info." Database: ".$db->database_name."
-- ------------------------------------------------------
Expand Down

0 comments on commit d8856ba

Please sign in to comment.