Skip to content

Commit

Permalink
Qual: Remove usage of getStaticMember function dir constants.
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jul 31, 2014
1 parent 0b2b84a commit 9fff304
Show file tree
Hide file tree
Showing 14 changed files with 19 additions and 25 deletions.
2 changes: 1 addition & 1 deletion htdocs/admin/system/database.php
Expand Up @@ -44,7 +44,7 @@
// Database
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Database").'</td></tr>'."\n";
print '<tr '.$bc[0].'><td width="300">'.$langs->trans("Version").'</td><td>'.getStaticMember(get_class($db),'label').' '.$db->getVersion().'</td></tr>'."\n";
print '<tr '.$bc[0].'><td width="300">'.$langs->trans("Version").'</td><td>'.$db::label.' '.$db->getVersion().'</td></tr>'."\n";
print '<tr '.$bc[1].'><td width="300">'.$langs->trans("DatabaseServer").'</td><td>'.$conf->db->host.'</td></tr>'."\n";
print '<tr '.$bc[0].'><td width="300">'.$langs->trans("DatabasePort").'</td><td>'.(empty($conf->db->port)?$langs->trans("Default"):$conf->db->port).'</td></tr>'."\n";
print '<tr '.$bc[1].'><td width="300">'.$langs->trans("DatabaseName").'</td><td>'.$conf->db->name.'</td></tr>'."\n";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/admin/system/index.php
Expand Up @@ -86,7 +86,7 @@
// Database
print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\"><td colspan=\"2\">".$langs->trans("Database")."</td></tr>\n";
$dblabel=getStaticMember(get_class($db),'label');
$dblabel=$db::label;
$dbversion=$db->getVersion();
print "<tr $bc[0]><td width=\"280\">".$langs->trans("Version")."</td><td>" .$dblabel." ".$dbversion."</td></tr>\n";
print '</table>';
Expand Down
2 changes: 1 addition & 1 deletion htdocs/admin/tools/dolibarr_export.php
Expand Up @@ -65,7 +65,7 @@
$form=new Form($db);
$formfile = new FormFile($db);

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

$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
llxHeader('','',$help_url);
Expand Down
2 changes: 1 addition & 1 deletion htdocs/admin/tools/dolibarr_import.php
Expand Up @@ -38,7 +38,7 @@
* View
*/

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

$help_url='EN:Restores|FR:Restaurations|ES:Restauraciones';
llxHeader('','',$help_url);
Expand Down
2 changes: 1 addition & 1 deletion htdocs/admin/tools/export.php
Expand Up @@ -416,7 +416,7 @@ function backup_tables($outputfile, $tables='*')

// Print headers and global mysql config vars
$sqlhead = '';
$sqlhead .= "-- ".getStaticMember($db, 'label')." dump via php
$sqlhead .= "-- ".$db::label." dump via php
--
-- Host: ".$db->db->host_info." Database: ".$db->database_name."
-- ------------------------------------------------------
Expand Down
4 changes: 0 additions & 4 deletions htdocs/core/db/DoliDB.class.php
Expand Up @@ -32,14 +32,10 @@ abstract class DoliDB implements Database
public $db;
//! Database type
public $type;
//! Database label
static $label;
//! Charset used to force charset when creating database
public $forcecharset='utf8';
//! Collate used to force collate when creating database
public $forcecollate='utf8_general_ci';
//! Min database version
static $versionmin;
//! Resultset of last query
private $_results;
//! 1 if connected, else 0
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/db/mssql.class.php
Expand Up @@ -33,13 +33,13 @@ class DoliDBMssql extends DoliDB
//! Database type
public $type='mssql';
//! Database label
static $label='MSSQL';
const label='MSSQL';
//! Charset used to force charset when creating database
var $forcecharset='latin1'; // Can't be static as it may be forced with a dynamic value
//! Collate used to force collate when creating database
var $forcecollate='latin1_swedish_ci'; // Can't be static as it may be forced with a dynamic value
//! Version min database
static $versionmin=array(2000);
const versionmin='2000';
//! Resultset of last query
private $_results;

Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/db/mysql.class.php
Expand Up @@ -34,9 +34,9 @@ class DoliDBMysql extends DoliDB
//! Database type
public $type='mysql';
//! Database label
static $label='MySQL';
const label='MySQL';
//! Version min database
static $versionmin=array(4,1,0);
const versionmin='4.1.0';
//! Resultset of last query
private $_results;

Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/db/mysqli.class.php
Expand Up @@ -34,9 +34,9 @@ class DoliDBMysqli extends DoliDB
//! Database type
public $type='mysqli';
//! Database label
static $label='MySQL';
const label='MySQL';
//! Version min database
static $versionmin=array(4,1,0);
const versionmin='4.1.0';
//! Resultset of last query
private $_results;

Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/db/pgsql.class.php
Expand Up @@ -37,13 +37,13 @@ class DoliDBPgsql extends DoliDB
//! Database type
public $type='pgsql'; // Name of manager
//! Database label
static $label='PostgreSQL'; // Label of manager
const label='PostgreSQL'; // Label of manager
//! Charset
var $forcecharset='UTF8'; // Can't be static as it may be forced with a dynamic value
//! Collate used to force collate when creating database
var $forcecollate=''; // Can't be static as it may be forced with a dynamic value
//! Version min database
static $versionmin=array(8,4,0); // Version min database
const versionmin='8.4.0'; // Version min database
//! Resultset of last query
private $_results;

Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/db/sqlite.class.php
Expand Up @@ -34,9 +34,9 @@ class DoliDBSqlite extends DoliDB
//! Database type
public $type='sqlite';
//! Database label
static $label='PDO Sqlite';
const label='PDO Sqlite';
//! Version min database
static $versionmin=array(3,0,0);
const versionmin='3.0.0';
//! Resultset of last query
private $_results;

Expand Down
2 changes: 0 additions & 2 deletions htdocs/install/etape1.php
Expand Up @@ -256,8 +256,6 @@
{
if (! empty($_POST["db_create_database"])) // If we create database, we force default value
{
//$defaultCharacterSet=getStaticMember(get_class($db),'forcecharset');
//$defaultDBSortingCollation=getStaticMember(get_class($db),'forcecollate');
$defaultCharacterSet=$db->forcecharset;
$defaultDBSortingCollation=$db->forcecollate;
}
Expand Down
6 changes: 3 additions & 3 deletions htdocs/install/fileconf.php
Expand Up @@ -307,10 +307,10 @@
include_once $dir."/".$file;

if ($type == 'sqlite') continue; // We hide sqlite because support can't be complete unti sqlit does not manage foreign key creation after table creation

// Version min of database
$versionbasemin=getStaticMember($class, 'versionmin');
$note='('.getStaticMember($class, 'label').' >= '.versiontostring($versionbasemin).')';
$versionbasemin=explode('.',$class::versionmin);
$note='('.$class::label.' >= '.$class::versionmin.')';

// Switch to mysql if mysqli is not present
if ($defaultype=='mysqli' && !function_exists('mysqli_connect')) $defaultype = 'mysql';
Expand Down
2 changes: 1 addition & 1 deletion htdocs/install/upgrade.php
Expand Up @@ -168,7 +168,7 @@
dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ServerVersion")." : $version");

// Test database version
$versionmindb=getStaticMember(get_class($db),'versionmin');
$versionmindb=$db::versionmin;
//print join('.',$versionarray).' - '.join('.',$versionmindb);
if (count($versionmindb) && count($versionarray)
&& versioncompare($versionarray,$versionmindb) < 0)
Expand Down

0 comments on commit 9fff304

Please sign in to comment.