Fix: infinite loop if documents directory not writable

This commit is contained in:
Laurent Destailleur 2009-02-02 18:33:44 +00:00
parent acde84a4e2
commit 04607575ac
6 changed files with 17 additions and 13 deletions

View File

@ -186,7 +186,8 @@ function dolibarr_syslog($message, $level=LOG_INFO)
* Si SYSLOG_FILE_NO_ERROR defini, on ne gere pas erreur ecriture log
* \param message Line to log. Ne doit pas etre traduit si level = LOG_ERR
* \param level Log level
* \remarks Cette fonction n'a un effet que si le module syslog est active.
* \remarks This function works only if syslog module is enabled.
* \remarks This must must not use any call to other function calling dol_syslog (avoid infinite loop).
* \remarks On Windows LOG_ERR=4, LOG_WARNING=5, LOG_NOTICE=LOG_INFO=LOG_DEBUG=6
* On Linux LOG_ERR=3, LOG_WARNING=4, LOG_INFO=6, LOG_DEBUG=7
*/
@ -225,8 +226,10 @@ function dol_syslog($message, $level=LOG_INFO)
$filelog=eregi_replace('DOL_DATA_ROOT',DOL_DATA_ROOT,$filelog);
if (defined("SYSLOG_FILE_NO_ERROR")) $file=@fopen($filelog,"a+");
else $file=fopen($filelog,"a+");
if ($file)
{
$ip='unknown_ip';
if (! empty($_SERVER["REMOTE_ADDR"])) $ip=$_SERVER["REMOTE_ADDR"];
@ -250,8 +253,8 @@ function dol_syslog($message, $level=LOG_INFO)
}
elseif (! defined("SYSLOG_FILE_NO_ERROR"))
{
$langs->load("main");
print $langs->trans("ErrorFailedToOpenFile",$filelog);
// Do not use call to functions that make call to dol_syslog, so no call to langs.
print "Error, failed to open file ".$filelog."\n";
}
}
else

View File

@ -145,6 +145,7 @@ if ($conf->main_force_https)
}
}
// Chargement des includes complementaires de presentation
if (! defined('NOREQUIREMENU')) require_once(DOL_DOCUMENT_ROOT ."/menu.class.php"); // Need 11ko memory (11ko in 2.2)
if (! defined('NOREQUIREHTML')) require_once(DOL_DOCUMENT_ROOT ."/html.form.class.php"); // Need 690ko memory (800ko in 2.2)
@ -340,6 +341,7 @@ else
// Remarks: On ne sauvegarde pas objet user car pose pb dans certains cas mal identifies
$login=$_SESSION["dol_login"];
$resultFetchUser=$user->fetch($login);
dolibarr_syslog("This is an already logged session. _SESSION['dol_login']=".$login);
if ($resultFetchUser <= 0)
{

View File

@ -181,8 +181,8 @@ class Translate {
// Check parameters
if (empty($domain))
{
dolibarr_syslog("Translate::Load ErrorWrongParameters",LOG_WARNING);
return -1;
dolibarr_print_error('',"Translate::Load ErrorWrongParameters");
exit;
}
// Check cache
@ -282,7 +282,8 @@ class Translate {
// Pour les langues aux fichiers parfois incomplets, on charge la langue alternative
if (! $newalt && $this->defaultlang != "fr_FR" && $this->defaultlang != "en_US")
{
dolibarr_syslog("Translate::Load loading alternate translation file (to complete ".$this->defaultlang."/".$domain.".lang file)", LOG_DEBUG);
// This function must not contains call to syslog
dolibarr_syslog("Translate::Load loading alternate translation file (to complete ".$this->defaultlang."/".$domain.".lang file)", LOG_DEBUG);
$this->load($domain,1);
}

View File

@ -228,13 +228,10 @@ class User extends CommonObject
}
// Recupere parametrage global propre a l'utilisateur
// \TODO a stocker/recuperer en session pour eviter ce select a chaque page
// \TODO Remove where on page and remove page field in databse (not used)
if ($loadpersonalconf)
{
$sql = "SELECT param, value FROM ".MAIN_DB_PREFIX."user_param";
$sql.= " WHERE fk_user = ".$this->id;
$sql.= " AND page = ''";
$result=$this->db->query($sql);
if ($result)
{
@ -868,7 +865,7 @@ class User extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
$sql.= " SET fk_member=".$member->id;
$sql.= " WHERE rowid=".$this->id;
dolibarr_syslog("User::create_from_member sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)

View File

@ -54,3 +54,5 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (19
-- SAINT MARTIN
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2461,246, '0','0','VAT Rate 0',1);
alter table llx_user_param drop column page;

View File

@ -1,6 +1,6 @@
-- ============================================================================
-- Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@ -22,7 +22,6 @@
create table llx_user_param
(
fk_user integer NOT NULL,
page varchar(255) NOT NULL,
param varchar(64) NOT NULL,
value varchar(255) NOT NULL,