45if (!defined(
'NOSESSION')) {
46 define(
'NOSESSION',
'1');
50$sapi_type = php_sapi_name();
51$script_file = basename(__FILE__);
55if (substr($sapi_type, 0, 3) ==
'cgi') {
56 echo
"Error: You are using PHP for CGI. To execute ".$script_file.
" from command line, you must use PHP for CLI mode.\n";
67define(
'EVEN_IF_ONLY_LOGIN_ALLOWED', 1);
72$tmp = empty($_SERVER[
'SCRIPT_FILENAME']) ?
'' : $_SERVER[
'SCRIPT_FILENAME'];
73$tmp2 = realpath(__FILE__);
75$j = strlen($tmp2) - 1;
76while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
80if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)).
"/master.inc.php")) {
81 $res = @include substr($tmp, 0, ($i + 1)).
"/master.inc.php";
83if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))).
"/master.inc.php")) {
84 $res = @include dirname(substr($tmp, 0, ($i + 1))).
"/master.inc.php";
87if (!$res && file_exists(
"../master.inc.php")) {
88 $res = @include
"../master.inc.php";
90if (!$res && file_exists(
"../../master.inc.php")) {
91 $res = @include
"../../master.inc.php";
93if (!$res && file_exists(
"../../../master.inc.php")) {
94 $res = @include
"../../../master.inc.php";
97 print
"Include of master fails";
115$result = $user->fetch(0,
'admin');
122$hookmanager->initHooks(array(
'cli'));
129print
"***** ".$script_file.
" (".$version.
") pid=".
dol_getmypid().
" *****\n";
130if (!isset($argv[1])) {
131 print
"Usage: ".$script_file.
" param1 param2 ...\n";
134print
'--- start'.
"\n";
135print
'Argument 1='.$argv[1].
"\n";
136print
'Argument 2='.$argv[2].
"\n";
224 print
'--- end ok'.
"\n";
226 print
'--- end error code='.$error.
"\n";
dol_getmypid()
Return getmypid() or random PID when function is disabled Some web hosts disable this php function fo...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...