2005-04-07 15:05:30 +02:00
< ? php
/* Copyright ( C ) 2004 - 2005 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2009-05-08 03:16:34 +02:00
* Copyright ( C ) 2004 - 2009 Laurent Destailleur < eldy @ users . sourceforge . net >
2005-04-07 15:05:30 +02:00
*
* 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
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2005-04-07 15:05:30 +02:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2019-09-23 21:55:30 +02:00
* along with this program . If not , see < https :// www . gnu . org / licenses />.
2005-04-07 15:05:30 +02:00
*/
/**
2009-05-08 03:16:34 +02:00
* \defgroup syslog Module syslog
* \brief Module pour gerer les messages d ' erreur dans syslog
2011-10-24 14:11:49 +02:00
* \file htdocs / core / modules / modSyslog . class . php
2009-05-08 03:16:34 +02:00
* \ingroup syslog
2021-03-20 13:55:43 +01:00
* \brief Description and activation file for the module syslog
2008-10-01 21:10:17 +02:00
*/
2005-04-07 15:05:30 +02:00
2020-04-10 10:59:32 +02:00
include_once DOL_DOCUMENT_ROOT . '/core/modules/DolibarrModules.class.php' ;
2005-04-07 15:05:30 +02:00
/**
2012-10-03 00:30:50 +02:00
* Class to enable / disable module Logs
2008-10-01 21:10:17 +02:00
*/
2005-04-07 15:05:30 +02:00
class modSyslog extends DolibarrModules
{
2008-10-01 21:10:17 +02:00
/**
2011-09-26 16:22:35 +02:00
* Constructor . Define names , constants , directories , boxes , permissions
*
2012-01-04 21:23:50 +01:00
* @ param DoliDB $db Database handler
2008-10-01 21:10:17 +02:00
*/
2019-02-25 20:35:59 +01:00
public function __construct ( $db )
2008-10-01 21:10:17 +02:00
{
2012-01-04 21:23:50 +01:00
$this -> db = $db ;
$this -> numero = 42 ;
2008-10-01 21:10:17 +02:00
2009-05-08 03:16:34 +02:00
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
$this -> family = " base " ;
2018-01-25 17:53:02 +01:00
// Module position in the family on 2 digits ('01', '10', '20', ...)
2019-06-21 13:25:40 +02:00
$this -> module_position = '75' ;
2008-10-01 21:10:17 +02:00
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
2019-01-27 11:55:16 +01:00
$this -> name = preg_replace ( '/^mod/i' , '' , get_class ( $this ));
2009-05-08 03:16:34 +02:00
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
$this -> description = " Activate debug logs (syslog) " ;
// Can be enabled / disabled only in the main company
2018-03-16 00:16:32 +01:00
$this -> core_enabled = 1 ;
2009-05-08 03:16:34 +02:00
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
2017-08-22 18:34:58 +02:00
$this -> version = 'dolibarr' ;
2009-05-08 03:16:34 +02:00
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
2008-10-06 09:39:52 +02:00
$this -> const_name = 'MAIN_MODULE_' . strtoupper ( $this -> name );
2009-05-08 14:08:54 +02:00
// Name of image file used for this module.
2020-06-29 13:48:00 +02:00
$this -> picto = 'bug' ;
2008-10-01 21:10:17 +02:00
2009-04-29 17:02:40 +02:00
// Data directories to create when module is enabled
2008-10-01 21:10:17 +02:00
$this -> dirs = array ();
// Config pages
$this -> config_page_url = array ( " syslog.php " );
2015-09-07 15:29:51 +02:00
// Dependencies
2020-04-10 10:59:32 +02:00
$this -> hidden = false ; // A condition to hide module
$this -> depends = array (); // List of module class names as string that must be enabled if this module is enabled
$this -> requiredby = array (); // List of module ids to disable if this one is disabled
$this -> conflictwith = array (); // List of module class names as string this module is in conflict with
2022-09-27 20:48:47 +02:00
$this -> phpmin = array ( 7 , 0 ); // Minimum version of PHP required by module
2008-10-01 21:10:17 +02:00
2015-09-07 15:40:55 +02:00
// Constants
2008-10-01 21:10:17 +02:00
$this -> const = array ();
2015-09-07 15:46:57 +02:00
// Boxes
2008-10-01 21:10:17 +02:00
$this -> boxes = array ();
// Permissions
$this -> rights = array ();
$this -> rights_class = 'syslog' ;
2018-03-09 16:52:06 +01:00
// Cronjobs
2019-10-07 20:48:44 +02:00
$comment = 'Compress and archive log files. The number of versions to keep is defined into the setup of module. ' ;
2020-04-10 10:59:32 +02:00
$comment .= 'Warning: Main application cron script must be run with same account than your web server to avoid to get log files with different owner than required by web server. ' ;
$comment .= 'Another solution is to set web server Operating System group as the group of directory documents and set GROUP permission "rws" on this directory so log files will always have the group and permissions of the web server Operating System group.' ;
2019-10-07 20:48:44 +02:00
2018-03-09 16:52:06 +01:00
$this -> cronjobs = array (
2018-10-30 15:32:09 +01:00
0 => array (
'label' => 'CompressSyslogs' ,
'jobtype' => 'method' ,
'class' => 'core/class/utils.class.php' ,
'objectname' => 'Utils' ,
'method' => 'compressSyslogs' ,
'parameters' => '' ,
2019-10-07 20:48:44 +02:00
'comment' => $comment ,
2018-10-30 15:32:09 +01:00
'frequency' => 1 ,
'unitfrequency' => 3600 * 24 ,
'priority' => 50 ,
'status' => 0 ,
'test' => true
)
2018-03-09 16:52:06 +01:00
);
2008-10-01 21:10:17 +02:00
}
2005-04-07 15:05:30 +02:00
}