Can use constant DOL_DATA_ROOT in log file name for syslog module
This commit is contained in:
parent
3e0cd4a9b4
commit
1fdd003848
@ -18,16 +18,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/admin/syslog.php
|
* \file htdocs/admin/syslog.php
|
||||||
\ingroup syslog
|
* \ingroup syslog
|
||||||
\brief Page de configuration du module syslog
|
* \brief Setup page for syslog module
|
||||||
\version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
||||||
|
|
||||||
if (!$user->admin)
|
if (!$user->admin)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
@ -38,8 +39,8 @@ $langs->load("other");
|
|||||||
*/
|
*/
|
||||||
if ($_POST["action"] == 'setlevel')
|
if ($_POST["action"] == 'setlevel')
|
||||||
{
|
{
|
||||||
dolibarr_set_const($db,"SYSLOG_LEVEL",$_POST["level"]);
|
dolibarr_set_const($db,"SYSLOG_LEVEL",$_POST["level"]);
|
||||||
dolibarr_syslog("admin/syslog: level ".$_POST["level"]);
|
dolibarr_syslog("admin/syslog: level ".$_POST["level"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST["action"] == 'set')
|
if ($_POST["action"] == 'set')
|
||||||
@ -47,35 +48,40 @@ if ($_POST["action"] == 'set')
|
|||||||
$optionlogoutput=$_POST["optionlogoutput"];
|
$optionlogoutput=$_POST["optionlogoutput"];
|
||||||
if ($optionlogoutput == "syslog")
|
if ($optionlogoutput == "syslog")
|
||||||
{
|
{
|
||||||
if (defined($_POST["facility"]))
|
if (defined($_POST["facility"]))
|
||||||
{
|
{
|
||||||
dolibarr_del_const($db,"SYSLOG_FILE");
|
dolibarr_del_const($db,"SYSLOG_FILE");
|
||||||
dolibarr_set_const($db,"SYSLOG_FACILITY",$_POST["facility"]);
|
dolibarr_set_const($db,"SYSLOG_FACILITY",$_POST["facility"]);
|
||||||
dolibarr_syslog("admin/syslog: facility ".$_POST["facility"]);
|
dolibarr_syslog("admin/syslog: facility ".$_POST["facility"]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<div class="error">'.$langs->trans("ErrorUnknownSyslogConstant",$_POST["facility"]).'</div>';
|
print '<div class="error">'.$langs->trans("ErrorUnknownSyslogConstant",$_POST["facility"]).'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($optionlogoutput == "file")
|
if ($optionlogoutput == "file")
|
||||||
{
|
{
|
||||||
$file=fopen($_POST["filename"],"a+");
|
$filelog=$_POST["filename"];
|
||||||
if ($file)
|
$filelog=eregi_replace('DOL_DATA_ROOT',DOL_DATA_ROOT,$filelog);
|
||||||
{
|
$file=fopen($filelog,"a+");
|
||||||
fclose($file);
|
if ($file)
|
||||||
dolibarr_del_const($db,"SYSLOG_FACILITY");
|
{
|
||||||
dolibarr_set_const($db,"SYSLOG_FILE",$_POST["filename"]);
|
fclose($file);
|
||||||
dolibarr_syslog("admin/syslog: file ".$_POST["filename"]);
|
dolibarr_del_const($db,"SYSLOG_FACILITY");
|
||||||
}
|
dolibarr_set_const($db,"SYSLOG_FILE",$_POST["filename"]);
|
||||||
else
|
dolibarr_syslog("admin/syslog: file ".$_POST["filename"]);
|
||||||
{
|
}
|
||||||
print '<div class="error">'.$langs->trans("ErrorFailedToOpenFile",$_POST["filename"]).'</div>';
|
else
|
||||||
}
|
{
|
||||||
|
print '<div class="error">'.$langs->trans("ErrorFailedToOpenFile",$_POST["filename"]).'</div>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
@ -91,9 +97,7 @@ $syslogfile=$defaultsyslogfile=dolibarr_get_const($db,"SYSLOG_FILE");
|
|||||||
if (! $defaultsyslogfacility) $defaultsyslogfacility='LOG_USER';
|
if (! $defaultsyslogfacility) $defaultsyslogfacility='LOG_USER';
|
||||||
if (! $defaultsyslogfile) $defaultsyslogfile='dolibarr.log';
|
if (! $defaultsyslogfile) $defaultsyslogfile='dolibarr.log';
|
||||||
|
|
||||||
/*
|
// Output mode
|
||||||
* Mode de sortie
|
|
||||||
*/
|
|
||||||
print_titre($langs->trans("SyslogOutput"));
|
print_titre($langs->trans("SyslogOutput"));
|
||||||
|
|
||||||
// Mode
|
// Mode
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user