mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 17:48:25 +01:00
Save MAIN_VERSION_FIRST_INSTALL that is not erased.
This commit is contained in:
@@ -846,7 +846,7 @@ function dol_strtoupper($utf8_string)
|
|||||||
* SYSLOG_HANDLERS = ["mod_syslog_syslog"] facility is then defined by SYSLOG_FACILITY
|
* SYSLOG_HANDLERS = ["mod_syslog_syslog"] facility is then defined by SYSLOG_FACILITY
|
||||||
* Warning, syslog functions are bugged on Windows, generating memory protection faults. To solve
|
* Warning, syslog functions are bugged on Windows, generating memory protection faults. To solve
|
||||||
* this, use logging to files instead of syslog (see setup of module).
|
* this, use logging to files instead of syslog (see setup of module).
|
||||||
* Note: If SYSLOG_FILE_NO_ERROR defined, we never output any error message when writing to log fails.
|
* Note: If constant 'SYSLOG_FILE_NO_ERROR' defined, we never output any error message when writing to log fails.
|
||||||
* Note: You can get log message into html sources by adding parameter &logtohtml=1 (constant MAIN_LOGTOHTML must be set)
|
* Note: You can get log message into html sources by adding parameter &logtohtml=1 (constant MAIN_LOGTOHTML must be set)
|
||||||
* This function works only if syslog module is enabled.
|
* This function works only if syslog module is enabled.
|
||||||
* This must not use any call to other function calling dol_syslog (avoid infinite loop).
|
* This must not use any call to other function calling dol_syslog (avoid infinite loop).
|
||||||
|
|||||||
@@ -127,12 +127,13 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
|
|||||||
|
|
||||||
$logfile = $this->getFilename($suffixinfilename);
|
$logfile = $this->getFilename($suffixinfilename);
|
||||||
|
|
||||||
if (! empty($conf->global->SYSLOG_FILE_NO_ERROR)) $filefd = @fopen($logfile, 'a+');
|
// Test constant SYSLOG_FILE_NO_ERROR (should stay a constant defined with define('SYSLOG_FILE_NO_ERROR',1);
|
||||||
|
if (defined('SYSLOG_FILE_NO_ERROR')) $filefd = @fopen($logfile, 'a+');
|
||||||
else $filefd = fopen($logfile, 'a+');
|
else $filefd = fopen($logfile, 'a+');
|
||||||
|
|
||||||
if (! $filefd)
|
if (! $filefd)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->SYSLOG_FILE_NO_ERROR))
|
if (! defined('SYSLOG_FILE_NO_ERROR') || ! constant('SYSLOG_FILE_NO_ERROR'))
|
||||||
{
|
{
|
||||||
// Do not break dolibarr usage if log fails
|
// Do not break dolibarr usage if log fails
|
||||||
//throw new Exception('Failed to open log file '.basename($logfile));
|
//throw new Exception('Failed to open log file '.basename($logfile));
|
||||||
@@ -151,7 +152,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
|
|||||||
LOG_INFO => 'INFO',
|
LOG_INFO => 'INFO',
|
||||||
LOG_DEBUG => 'DEBUG'
|
LOG_DEBUG => 'DEBUG'
|
||||||
);
|
);
|
||||||
|
|
||||||
$delay = "";
|
$delay = "";
|
||||||
if (!empty($conf->global->MAIN_SYSLOG_SHOW_DELAY))
|
if (!empty($conf->global->MAIN_SYSLOG_SHOW_DELAY))
|
||||||
{
|
{
|
||||||
@@ -159,7 +160,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
|
|||||||
$delay = " ".sprintf("%05.3f", $this->lastTime != 0 ? $now - $this->lastTime : 0);
|
$delay = " ".sprintf("%05.3f", $this->lastTime != 0 ? $now - $this->lastTime : 0);
|
||||||
$this->lastTime = $now;
|
$this->lastTime = $now;
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = dol_print_date(time(),"%Y-%m-%d %H:%M:%S").$delay." ".sprintf("%-7s", $logLevels[$content['level']])." ".sprintf("%-15s", $content['ip'])." ".($this->ident>0?str_pad('',$this->ident,' '):'').$content['message'];
|
$message = dol_print_date(time(),"%Y-%m-%d %H:%M:%S").$delay." ".sprintf("%-7s", $logLevels[$content['level']])." ".sprintf("%-15s", $content['ip'])." ".($this->ident>0?str_pad('',$this->ident,' '):'').$content['message'];
|
||||||
fwrite($filefd, $message."\n");
|
fwrite($filefd, $message."\n");
|
||||||
fclose($filefd);
|
fclose($filefd);
|
||||||
|
|||||||
@@ -38,6 +38,8 @@
|
|||||||
ALTER TABLE llx_extrafields ADD COLUMN fieldcomputed text;
|
ALTER TABLE llx_extrafields ADD COLUMN fieldcomputed text;
|
||||||
ALTER TABLE llx_extrafields ADD COLUMN fielddefault varchar(255);
|
ALTER TABLE llx_extrafields ADD COLUMN fielddefault varchar(255);
|
||||||
|
|
||||||
|
ALTER TABLE llx_c_typent MODIFY COLUMN libelle varchar(64);
|
||||||
|
|
||||||
ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP;
|
ALTER TABLE llx_opensurvey_sondage MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP;
|
||||||
|
|
||||||
ALTER TABLE llx_opensurvey_sondage ADD COLUMN fk_user_creat integer NOT NULL DEFAULT 0;
|
ALTER TABLE llx_opensurvey_sondage ADD COLUMN fk_user_creat integer NOT NULL DEFAULT 0;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ create table llx_c_typent
|
|||||||
(
|
(
|
||||||
id integer PRIMARY KEY,
|
id integer PRIMARY KEY,
|
||||||
code varchar(12) NOT NULL,
|
code varchar(12) NOT NULL,
|
||||||
libelle varchar(48),
|
libelle varchar(64),
|
||||||
fk_country integer NULL, -- Defined only to have specific list for countries that can't use generic list (like argentina that need type A or B)
|
fk_country integer NULL, -- Defined only to have specific list for countries that can't use generic list (like argentina that need type A or B)
|
||||||
active tinyint DEFAULT 1 NOT NULL,
|
active tinyint DEFAULT 1 NOT NULL,
|
||||||
module varchar(32) NULL,
|
module varchar(32) NULL,
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ include 'inc.php';
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$action=GETPOST('action','alpha');
|
$action=GETPOST('action','alpha');
|
||||||
$setuplang=(GETPOST('selectlang','',3)?GETPOST('selectlang','',3):'auto');
|
$setuplang=(GETPOST('selectlang','aZ09',3)?GETPOST('selectlang','aZ09',3):'auto');
|
||||||
$langs->setDefaultLang($setuplang);
|
$langs->setDefaultLang($setuplang);
|
||||||
|
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
@@ -341,7 +341,7 @@ if (! $error && $db->connected && $action == "set")
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show title of step
|
// Show title of step
|
||||||
print '<h3>'.$langs->trans("ConfigurationFile").'</h3>';
|
print '<h3><img class="valigntextbottom" src="../theme/common/octicons/lib/svg/gear.svg" width="20" alt="Configuration"> '.$langs->trans("ConfigurationFile").'</h3>';
|
||||||
print '<table cellspacing="0" width="100%" cellpadding="1" border="0">';
|
print '<table cellspacing="0" width="100%" cellpadding="1" border="0">';
|
||||||
|
|
||||||
// Check parameter main_dir
|
// Check parameter main_dir
|
||||||
@@ -552,7 +552,7 @@ if (! $error && $db->connected && $action == "set")
|
|||||||
if ($db->connected)
|
if ($db->connected)
|
||||||
{
|
{
|
||||||
$resultbis = 1;
|
$resultbis = 1;
|
||||||
|
|
||||||
// Create user
|
// Create user
|
||||||
$result=$db->DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
|
$result=$db->DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
|
||||||
// Create user bis
|
// Create user bis
|
||||||
@@ -563,7 +563,7 @@ if (! $error && $db->connected && $action == "set")
|
|||||||
$resultbis=$db->DDLCreateUser('%', $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
|
$resultbis=$db->DDLCreateUser('%', $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result > 0 && $resultbis > 0)
|
if ($result > 0 && $resultbis > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ if (! is_writable($conffile))
|
|||||||
|
|
||||||
if ($action == "set")
|
if ($action == "set")
|
||||||
{
|
{
|
||||||
print '<h3>'.$langs->trans("Database").'</h3>';
|
print '<h3><img class="valigntextbottom" src="../theme/common/octicons/lib/svg/database.svg" width="20" alt="Database"> '.$langs->trans("Database").'</h3>';
|
||||||
|
|
||||||
print '<table cellspacing="0" style="padding: 4px 4px 4px 0px" border="0" width="100%">';
|
print '<table cellspacing="0" style="padding: 4px 4px 4px 0px" border="0" width="100%">';
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|||||||
@@ -174,13 +174,13 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
|
|||||||
{
|
{
|
||||||
$numrows=$db->num_rows($resql);
|
$numrows=$db->num_rows($resql);
|
||||||
if ($numrows == 0) dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1",'chaine',0,'',$conf->entity);
|
if ($numrows == 0) dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1",'chaine',0,'',$conf->entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create user used to create the admin user
|
// Create user used to create the admin user
|
||||||
$createuser=new User($db);
|
$createuser=new User($db);
|
||||||
$createuser->id=0;
|
$createuser->id=0;
|
||||||
$createuser->admin=1;
|
$createuser->admin=1;
|
||||||
|
|
||||||
// Set admin user
|
// Set admin user
|
||||||
$newuser = new User($db);
|
$newuser = new User($db);
|
||||||
$newuser->lastname='SuperAdmin';
|
$newuser->lastname='SuperAdmin';
|
||||||
@@ -216,10 +216,15 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
|
|||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
|
dolibarr_install_syslog('step5: set MAIN_VERSION_FIRST_INSTALL const to ' . $targetversion, LOG_DEBUG);
|
||||||
|
$resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_FIRST_INSTALL',1).",".$db->encrypt($targetversion,1).",'chaine',0,'Dolibarr version when first install',0)");
|
||||||
|
//if (! $resql) dol_print_error($db,'Error in setup program'); // We ignore errors. Key may already exists
|
||||||
|
$conf->global->MAIN_VERSION_FIRST_INSTALL=$targetversion;
|
||||||
|
|
||||||
dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_INSTALL const to ' . $targetversion, LOG_DEBUG);
|
dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_INSTALL const to ' . $targetversion, LOG_DEBUG);
|
||||||
$resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_INSTALL'");
|
$resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_INSTALL'");
|
||||||
if (! $resql) dol_print_error($db,'Error in setup program');
|
if (! $resql) dol_print_error($db,'Error in setup program');
|
||||||
$resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_LAST_INSTALL',1).",".$db->encrypt($targetversion,1).",'chaine',0,'Dolibarr version when install',0)");
|
$resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_LAST_INSTALL',1).",".$db->encrypt($targetversion,1).",'chaine',0,'Dolibarr version when last install',0)");
|
||||||
if (! $resql) dol_print_error($db,'Error in setup program');
|
if (! $resql) dol_print_error($db,'Error in setup program');
|
||||||
$conf->global->MAIN_VERSION_LAST_INSTALL=$targetversion;
|
$conf->global->MAIN_VERSION_LAST_INSTALL=$targetversion;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user