Work on POO optimize

This commit is contained in:
Laurent Destailleur 2011-12-21 19:34:16 +01:00
parent 4772e51d12
commit fce53afce4
8 changed files with 26 additions and 24 deletions

View File

@ -83,7 +83,6 @@ if ($_GET["msg"])
print "\n";
}
?>
<!-- Dump of a server -->
@ -100,7 +99,7 @@ if ($_GET["msg"])
<div id="div_container_exportoptions">
<fieldset id="exportoptions"><legend><?php echo $langs->trans("ExportMethod"); ?></legend>
<?php
if ($db->label == 'MySQL')
if ($db::$label == 'MySQL')
{
?>
<div class="formelementrow"><input type="radio" name="what" value="mysql" id="radio_dump_mysql" />
@ -113,7 +112,7 @@ if ($_GET["msg"])
<?php
}
}
else if ($db->label == 'PostgreSQL')
else if ($db::$label == 'PostgreSQL')
{
?>
<div class="formelementrow"><input type="radio" name="what" value="postgresql" id="radio_dump_postgresql" />
@ -123,7 +122,7 @@ if ($_GET["msg"])
}
else
{
print 'No method available with database '.$db->label;
print 'No method available with database '.$db::$label;
}
?>
</fieldset>
@ -135,7 +134,7 @@ if ($_GET["msg"])
<div id="div_container_sub_exportoptions">
<?php
if ($db->label == 'MySQL')
if ($db::$label == 'MySQL')
{
?> <!-- Fieldset mysqldump -->
<fieldset id="mysql_options"><legend><?php echo $langs->trans("MySqlExportParameters"); ?></legend>
@ -218,7 +217,7 @@ if ($_GET["msg"])
<?php
}
if ($db->label == 'PostgreSQL')
if ($db::$label == 'PostgreSQL')
{
?> <!-- Fieldset pg_dump -->
<fieldset id="postgresql_options"><legend><?php echo $langs->trans("PostgreSqlExportParameters"); ?></legend>
@ -282,8 +281,8 @@ if ($_GET["msg"])
id="filename_template"
value="<?php
$prefix='dump';
if ($db->label == 'MySQL') $prefix='mysqldump';
if ($db->label == 'PostgreSQL') $prefix='pg_dump';
if ($db::$label == 'MySQL') $prefix='mysqldump';
if ($db::$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>
@ -297,7 +296,7 @@ $compression=array(
// '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 ($db::$label == 'MySQL')
{
$compression['bz']=array('function' => 'bzopen', 'id' => 'radio_compression_bzip', 'label' => $langs->trans("Bzip2"));
}
@ -331,10 +330,10 @@ print "\n";
?></fieldset>
<center><input type="submit" class="button"
<div align="center"><input type="submit" class="button"
value="<?php echo $langs->trans("GenerateBackup") ?>" id="buttonGo" /><br>
<br>
</center>
</div>
</form>

View File

@ -69,7 +69,7 @@ print $langs->trans("RestoreDesc3",DOL_DATA_ROOT).'<br><br>';
<fieldset id="exportoptions">
<legend><?php echo $langs->trans("ImportMethod"); ?></legend>
<?php
if ($db->label == 'MySQL')
if ($db::$label == 'MySQL')
{
?>
<div class="formelementrow">
@ -78,7 +78,7 @@ print $langs->trans("RestoreDesc3",DOL_DATA_ROOT).'<br><br>';
</div>
<?php
}
else if ($db->label == 'PostgreSQL')
else if ($db::$label == 'PostgreSQL')
{
?>
<div class="formelementrow">
@ -89,7 +89,7 @@ print $langs->trans("RestoreDesc3",DOL_DATA_ROOT).'<br><br>';
}
else
{
print 'No method available with database '.$db->label;
print 'No method available with database '.$db::$label;
}
?>
</fieldset>
@ -101,7 +101,7 @@ print $langs->trans("RestoreDesc3",DOL_DATA_ROOT).'<br><br>';
<div id="div_container_sub_exportoptions">
<?php
if ($db->label == 'MySQL')
if ($db::$label == 'MySQL')
{
?>
<fieldset id="mysql_options">
@ -135,7 +135,7 @@ if ($db->label == 'MySQL')
</fieldset>
<?php
}
else if ($db->label == 'PostgreSQL')
else if ($db::$label == 'PostgreSQL')
{
?>
<fieldset id="postgresql_options">

View File

@ -208,7 +208,7 @@ if ($what == 'mysql')
@dol_delete_file($outputerror,1);
@rename($outputfile,$outputerror);
// Si safe_mode on et command hors du parametre exec, on a un fichier out vide donc errormsg vide
if (! $errormsg)
if (! $errormsg)
{
$langs->load("errors");
$errormsg=$langs->trans("ErrorFailedToRunExternalCommand");
@ -395,7 +395,7 @@ function backup_tables($outputfile, $tables='*')
// Print headers and global mysql config vars
$sqlhead = '';
$sqlhead .= "-- ".$db->label." dump via php
$sqlhead .= "-- ".$db::$label." dump via php
--
-- Host: ".$db->db->host_info." Database: ".$db->database_name."
-- ------------------------------------------------------

View File

@ -34,7 +34,7 @@ class DoliDBMssql
//! Database handler
var $db;
//! Database type
static $type='mssql';
public $type='mssql';
//! Database label
static $label='MSSQL';
//! Charset used to force charset when creating database

View File

@ -34,7 +34,7 @@ class DoliDBMysql
//! Database handler
var $db;
//! Database type
static $type='mysql';
public $type='mysql';
//! Database label
static $label='MySQL';
//! Charset used to force charset when creating database

View File

@ -34,7 +34,7 @@ class DoliDBMysqli
//! Database handler
var $db;
//! Database type
static $type='mysqli';
public $type='mysqli';
//! Database label
static $label='MySQL';
//! Charset used to force charset when creating database

View File

@ -32,8 +32,11 @@
*/
class DoliDBPgsql
{
var $db; // Database handler
static $type='pgsql'; // Name of manager
//! Database handler
var $db;
//! Database type
public $type='pgsql'; // Name of manager
//! Database label
static $label='PostgreSQL'; // Label of manager
//! Charset
static $forcecharset='latin1';

View File

@ -34,7 +34,7 @@ class DoliDBSqlite
//! Database handler
var $db;
//! Database type
static $type='sqlite';
public $type='sqlite';
//! Database label
static $label='Sqlite';
//! Charset used to force charset when creating database