dolibarr  7.0.0-beta
Public Member Functions | List of all members
Utils Class Reference

Class to manage utility methods. More...

Public Member Functions

 __construct ($db)
 Constructor. More...
 
 purgeFiles ($choice='tempfilesold')
 Purge files into directory of data files. More...
 
 dumpDatabase ($compression='none', $type='auto', $usedefault=1, $file='auto', $keeplastnfiles=0)
 Make a backup of database CAN BE A CRON TASK. More...
 
 executeCLI ($command, $outputfile, $execmethod=0)
 Execute a CLI command. More...
 
 generateDoc ($module)
 Generate documentation of a Module. More...
 

Detailed Description

Class to manage utility methods.

Definition at line 28 of file utils.class.php.

Constructor & Destructor Documentation

Utils::__construct (   $db)

Constructor.

Parameters
DoliDB$dbDatabase handler

Definition at line 40 of file utils.class.php.

Member Function Documentation

Utils::dumpDatabase (   $compression = 'none',
  $type = 'auto',
  $usedefault = 1,
  $file = 'auto',
  $keeplastnfiles = 0 
)

Make a backup of database CAN BE A CRON TASK.

Parameters
string$compression'gz' or 'bz' or 'none'
string$type'mysql', 'postgresql', ...
int$usedefault1=Use default backup profile (Set this to 1 when used as cron)
string$file'auto' or filename to build
int$keeplastnfilesKeep only last n files (not used yet)
Returns
int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)

Definition at line 178 of file utils.class.php.

References dol_compress_file(), dol_delete_file(), dol_dir_list(), dol_mkdir(), dol_sanitizeFileName(), dol_syslog(), and GETPOST().

Utils::executeCLI (   $command,
  $outputfile,
  $execmethod = 0 
)

Execute a CLI command.

Parameters
string$commandCommand line to execute.
string$outputfileOutput file (used only when method is 2). For exemple $conf->admin->dir_temp.'/out.tmp';
int$execmethod0=Use default method (that is 1 by default), 1=Use the PHP 'exec', 2=Use the 'popen' method
Returns
array array('result'=>...,'output'=>...,'error'=>...). result = 0 means OK.

Definition at line 463 of file utils.class.php.

References dol_syslog().

Utils::generateDoc (   $module)

Generate documentation of a Module.

Parameters
string$moduleModule name
Returns
int <0 if KO, >0 if OK

Definition at line 532 of file utils.class.php.

References dol_buildpath(), dol_dir_list(), dol_include_once(), dol_is_dir(), dol_mkdir(), and dol_print_error().

Utils::purgeFiles (   $choice = 'tempfilesold')

Purge files into directory of data files.

CAN BE A CRON TASK

Parameters
string$choiceChoice of purge mode ('tempfiles', 'tempfilesold' to purge temp older than 24h, 'allfiles', 'logfile')
Returns
int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)

Definition at line 53 of file utils.class.php.

References dol_delete_dir_recursive(), dol_delete_file(), dol_dir_list(), dol_now(), and dol_syslog().


The documentation for this class was generated from the following file: