30if (!defined(
'NOTOKENRENEWAL')) {
31 define(
'NOTOKENRENEWAL',
'1');
33if (!defined(
'NOREQUIREMENU')) {
34 define(
'NOREQUIREMENU',
'1');
36if (!defined(
'NOREQUIREHTML')) {
37 define(
'NOREQUIREHTML',
'1');
39if (!defined(
'NOREQUIREAJAX')) {
40 define(
'NOREQUIREAJAX',
'1');
42if (!defined(
'NOLOGIN')) {
43 define(
'NOLOGIN',
'1');
45if (!defined(
'NOSESSION')) {
46 define(
'NOSESSION',
'1');
50if (!defined(
'USESUFFIXINLOG')) {
51 define(
'USESUFFIXINLOG',
'_cron');
54$sapi_type = php_sapi_name();
55$script_file = basename(__FILE__);
59if (substr($sapi_type, 0, 3) ==
'cgi') {
60 echo
"Error: You are using PHP for CGI. To execute ".$script_file.
" from command line, you must use PHP for CLI mode.\n";
64require_once $path.
"../../htdocs/master.inc.php";
65require_once DOL_DOCUMENT_ROOT.
'/core/lib/functionscli.lib.php';
66require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
67require_once DOL_DOCUMENT_ROOT.
"/cron/class/cronjob.class.php";
68require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
81if (!isset($argv[1]) || !$argv[1]) {
82 usageScript($path, $script_file);
87if (!in_array($key, array(
'showpass',
'encodepass',
'decodepass'))) {
88 usageScript($path, $script_file);
94$version = DOL_VERSION;
97$hookmanager->initHooks(array(
'cli'));
108print
"***** ".$script_file.
" (".$version.
") pid=".dol_getmypid().
" - ".
dol_print_date($now,
'dayhourrfc',
'gmt').
" - ".gethostname().
" *****\n";
114if ($key ==
'showpass') {
115 print
dolDecrypt($dolibarr_main_db_pass).
"\n";
116} elseif ($key ==
'encodepass') {
119} elseif ($key ==
'decodepass') {
136function usageScript($path, $script_file)
138 print
"Usage: ".$script_file.
" showpass|encodepass|decodepass\n";
dol_now($mode='gmt')
Return date for now.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
encodedecode_dbpassconf($level=0)
Encode or decode database password in config file.
dolDecrypt($chain, $key='')
Decode a string with a symmetric encryption.