dolibarr
16.0.4
|
Class to manage utility methods. More...
Public Member Functions | |
__construct ($db) | |
Constructor. More... | |
purgeFiles ($choices='tempfilesold+logfiles', $nbsecondsold=86400) | |
Purge files into directory of data files. More... | |
dumpDatabase ($compression='none', $type='auto', $usedefault=1, $file='auto', $keeplastnfiles=0, $execmethod=0, $lowmemorydump=0) | |
Make a backup of database CAN BE A CRON TASK. More... | |
executeCLI ($command, $outputfile, $execmethod=0, $redirectionfile=null, $noescapecommand=0, $redirectionfileerr=null) | |
Execute a CLI command. More... | |
generateDoc ($module) | |
Generate documentation of a Module. More... | |
compressSyslogs () | |
This saves syslog files and compresses older ones. More... | |
sendBackup ($sendto='', $from='', $subject='', $message='', $filename='', $filter='') | |
Make a send last backup of database or fil in param CAN BE A CRON TASK. More... | |
Public Attributes | |
$db | |
Class to manage utility methods.
Definition at line 30 of file utils.class.php.
Utils::__construct | ( | $db | ) |
Utils::compressSyslogs | ( | ) |
This saves syslog files and compresses older ones.
Nb of archive to keep is defined into $conf->global->SYSLOG_FILE_SAVES CAN BE A CRON TASK
Definition at line 941 of file utils.class.php.
Utils::dumpDatabase | ( | $compression = 'none' , |
|
$type = 'auto' , |
|||
$usedefault = 1 , |
|||
$file = 'auto' , |
|||
$keeplastnfiles = 0 , |
|||
$execmethod = 0 , |
|||
$lowmemorydump = 0 |
|||
) |
Make a backup of database CAN BE A CRON TASK.
string | $compression | 'gz' or 'bz' or 'none' |
string | $type | 'mysql', 'postgresql', ... |
int | $usedefault | 1=Use default backup profile (Set this to 1 when used as cron) |
string | $file | 'auto' or filename to build |
int | $keeplastnfiles | Keep only last n files (not used yet) |
int | $execmethod | 0=Use default method (that is 1 by default), 1=Use the PHP 'exec' - need size of dump in memory, but low memory method is used if GETPOST('lowmemorydump') is set, 2=Use the 'popen' method (low memory method) |
int | $lowmemorydump | 1=Use the low memory method |
Definition at line 197 of file utils.class.php.
Utils::executeCLI | ( | $command, | |
$outputfile, | |||
$execmethod = 0 , |
|||
$redirectionfile = null , |
|||
$noescapecommand = 0 , |
|||
$redirectionfileerr = null |
|||
) |
Execute a CLI command.
string | $command | Command line to execute. Warning: The command line is sanitize so can't contains any redirection char '>'. Use param $redirectionfile if you need it. |
string | $outputfile | A path for an output file (used only when method is 2). For example: $conf->admin->dir_temp.'/out.tmp'; |
int | $execmethod | 0=Use default method (that is 1 by default), 1=Use the PHP 'exec', 2=Use the 'popen' method |
string | $redirectionfile | If defined, a redirection of output to this file is added. |
int | $noescapecommand | 1=Do not escape command. Warning: Using this parameter need you alreay sanitized the command. if not, it will lead to security vulnerability. This parameter is provided for backward compatibility with external modules. Always use 0 in core. |
string | $redirectionfileerr | If defined, a redirection of error is added to this file instead of to channel 1. |
Definition at line 661 of file utils.class.php.
Utils::generateDoc | ( | $module | ) |
Generate documentation of a Module.
string | $module | Module name |
Definition at line 740 of file utils.class.php.
Utils::purgeFiles | ( | $choices = 'tempfilesold+logfiles' , |
|
$nbsecondsold = 86400 |
|||
) |
Purge files into directory of data files.
CAN BE A CRON TASK
string | $choices | Choice of purge mode ('tempfiles', 'tempfilesold' to purge temp older than $nbsecondsold seconds, 'logfiles', or mix of this). Note 'allfiles' is possible too but very dangerous. |
int | $nbsecondsold | Nb of seconds old to accept deletion of a directory if $choice is 'tempfilesold' |
Definition at line 59 of file utils.class.php.
Utils::sendBackup | ( | $sendto = '' , |
|
$from = '' , |
|||
$subject = '' , |
|||
$message = '' , |
|||
$filename = '' , |
|||
$filter = '' |
|||
) |
Make a send last backup of database or fil in param CAN BE A CRON TASK.
string | $sendto | Recipients emails |
string | $from | Sender email |
string | $subject | Topic/Subject of mail |
string | $message | Message |
string | $filename | List of files to attach (full path of filename on file system) |
string | $filter | Filter file send |
Definition at line 1243 of file utils.class.php.
DoliDBMysqli Utils::$db |
Definition at line 35 of file utils.class.php.
Referenced by __construct().