diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8a9bd1e88b6ed3475798717d71e6bc8cf06fa018..a09ebd6fe7d344a07ced1fb9d79a8438ceef37a8 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -846,7 +846,7 @@ function dol_strtoupper($utf8_string) * 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 * 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) * This function works only if syslog module is enabled. * This must not use any call to other function calling dol_syslog (avoid infinite loop). diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index 68493fd4eb4e994df3dab9e9c4bf7bc4adf00b9b..b059c63e003405110498619109214c4349267cd2 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -127,12 +127,13 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface $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+'); 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 //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_DEBUG => 'DEBUG' ); - + $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); $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']; fwrite($filefd, $message."\n"); fclose($filefd); diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index 85b9d3106cf27388f47010ec8565e02274fc01a9..09d6c4de4751b107ccaf01fa5c6905117d1e7d94 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -38,6 +38,8 @@ ALTER TABLE llx_extrafields ADD COLUMN fieldcomputed text; 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 ADD COLUMN fk_user_creat integer NOT NULL DEFAULT 0; diff --git a/htdocs/install/mysql/tables/llx_c_typent.sql b/htdocs/install/mysql/tables/llx_c_typent.sql index ae89faf5c740416e932ceede654e4716ef62cc54..5b78abf1a75a3a0a0427b51c186168e5b539c41a 100644 --- a/htdocs/install/mysql/tables/llx_c_typent.sql +++ b/htdocs/install/mysql/tables/llx_c_typent.sql @@ -21,7 +21,7 @@ create table llx_c_typent ( id integer PRIMARY KEY, 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) active tinyint DEFAULT 1 NOT NULL, module varchar(32) NULL, diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index b1a9fabb20d2ae6881a6c1bfa0271944e9a7b467..a57ffd0c6742d787774b649625c550d1688b1fe8 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -33,7 +33,7 @@ include 'inc.php'; global $langs; $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->load("admin"); @@ -341,7 +341,7 @@ if (! $error && $db->connected && $action == "set") } // 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">'; // Check parameter main_dir @@ -552,7 +552,7 @@ if (! $error && $db->connected && $action == "set") if ($db->connected) { $resultbis = 1; - + // Create user $result=$db->DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name); // 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); } } - + if ($result > 0 && $resultbis > 0) { diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index baceee5f7ebefd9f11d2dc3292001bbf610957c4..ae5adc4e471c421722368ad3ef7ce3b9d2d6a662 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -86,7 +86,7 @@ if (! is_writable($conffile)) 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%">'; $error=0; diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php index 875fd9378f2b99d21b6a45b0b0528a07f4899326..b4bf7987547563ae65cb1348c112ed944c4de50d 100644 --- a/htdocs/install/step5.php +++ b/htdocs/install/step5.php @@ -174,13 +174,13 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) { $numrows=$db->num_rows($resql); if ($numrows == 0) dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1",'chaine',0,'',$conf->entity); - } - + } + // Create user used to create the admin user $createuser=new User($db); $createuser->id=0; $createuser->admin=1; - + // Set admin user $newuser = new User($db); $newuser->lastname='SuperAdmin'; @@ -216,10 +216,15 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) { $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); $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'); - $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'); $conf->global->MAIN_VERSION_LAST_INSTALL=$targetversion;