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

View File

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

View File

@ -395,7 +395,7 @@ function backup_tables($outputfile, $tables='*')
// Print headers and global mysql config vars // Print headers and global mysql config vars
$sqlhead = ''; $sqlhead = '';
$sqlhead .= "-- ".$db->label." dump via php $sqlhead .= "-- ".$db::$label." dump via php
-- --
-- Host: ".$db->db->host_info." Database: ".$db->database_name." -- Host: ".$db->db->host_info." Database: ".$db->database_name."
-- ------------------------------------------------------ -- ------------------------------------------------------

View File

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

View File

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

View File

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

View File

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

View File

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