diff --git a/htdocs/admin/system/database.php b/htdocs/admin/system/database.php index d9833a13d01..d7f39530502 100644 --- a/htdocs/admin/system/database.php +++ b/htdocs/admin/system/database.php @@ -44,7 +44,7 @@ print_fiche_titre($langs->trans("InfoDatabase"),'','setup'); // Database print ''; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; diff --git a/htdocs/admin/system/index.php b/htdocs/admin/system/index.php index a9d6cfa1afb..71ce99d5525 100644 --- a/htdocs/admin/system/index.php +++ b/htdocs/admin/system/index.php @@ -86,7 +86,7 @@ print "
\n"; // Database print '
'.$langs->trans("Database").'
'.$langs->trans("Version").''.getStaticMember(get_class($db),'label').' '.$db->getVersion().'
'.$langs->trans("Version").''.$db::label.' '.$db->getVersion().'
'.$langs->trans("DatabaseServer").''.$conf->db->host.'
'.$langs->trans("DatabasePort").''.(empty($conf->db->port)?$langs->trans("Default"):$conf->db->port).'
'.$langs->trans("DatabaseName").''.$conf->db->name.'
'; print "\n"; -$dblabel=getStaticMember(get_class($db),'label'); +$dblabel=$db::label; $dbversion=$db->getVersion(); print "\n"; print '
".$langs->trans("Database")."
".$langs->trans("Version")."" .$dblabel." ".$dbversion."
'; diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 8154cfffb08..9f4e62155c2 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -65,7 +65,7 @@ if ($action == 'delete') $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); diff --git a/htdocs/admin/tools/dolibarr_import.php b/htdocs/admin/tools/dolibarr_import.php index 61e7e1e68a1..b18aefc75a5 100644 --- a/htdocs/admin/tools/dolibarr_import.php +++ b/htdocs/admin/tools/dolibarr_import.php @@ -38,7 +38,7 @@ $showpass=GETPOST('showpass'); * View */ -$label=getStaticMember($db, 'label'); +$label=$db::label; $help_url='EN:Restores|FR:Restaurations|ES:Restauraciones'; llxHeader('','',$help_url); diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 8dccf89de09..ca12f3fbc38 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -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." -- ------------------------------------------------------ diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index aa0792c5970..e0921f7acac 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -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 diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 39b9afdb75b..820706cd6f1 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -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; diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 8f852aba3ec..ac1a6d0e2f6 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -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; diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index d44e37b7591..e86490ac88c 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -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; diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 61de279e24c..9110d7cea06 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -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; diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index 924f489fc4d..fbae9300ddd 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -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; diff --git a/htdocs/install/etape1.php b/htdocs/install/etape1.php index 43d063bf270..831283c6a46 100644 --- a/htdocs/install/etape1.php +++ b/htdocs/install/etape1.php @@ -256,8 +256,6 @@ if (! $error && $db->connected) { 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; } diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 665d766a8dd..7e681e1b21b 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -307,10 +307,10 @@ if (! empty($force_install_message)) 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'; diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index 875f5974dd7..f88047e5017 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -168,7 +168,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) 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)