dolibarr 22.0.5
check_blockedlog.php
Go to the documentation of this file.
1#!/usr/bin/env php
2<?php
3/*
4 * Copyright (C) 2025 Laurent Destailleur <eldy@users.sourceforge.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26if (!defined('NOSESSION')) {
27 define('NOSESSION', '1');
28}
29
30$sapi_type = php_sapi_name();
31$script_file = basename(__FILE__);
32$path = __DIR__.'/';
33
34// Test if batch mode
35if (substr($sapi_type, 0, 3) == 'cgi') {
36 echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
37 exit(1);
38}
39
40require_once $path."../../htdocs/master.inc.php";
41require_once DOL_DOCUMENT_ROOT.'/core/lib/functionscli.lib.php';
42require_once DOL_DOCUMENT_ROOT."/contact/class/contact.class.php";
43require_once DOL_DOCUMENT_ROOT."/user/class/user.class.php";
44
53// Global variables
54$version = DOL_VERSION;
55$error = 0;
56$confirmed = 0;
57
58$hookmanager->initHooks(array('cli'));
59
60
61/*
62 * Main
63 */
64
65@set_time_limit(0);
66print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
67dol_syslog($script_file." launched with arg ".implode(',', $argv));
68
69if (!isset($argv[1]) || !$argv[1]) {
70 print "Usage: $script_file option1|option2\n";
71 exit(1);
72}
73
74foreach ($argv as $key => $val) {
75 if (preg_match('/-y$/', $val, $reg)) {
76 $confirmed = 1;
77 }
78}
79
80$now = $argv[1];
81
82if (!empty($dolibarr_main_db_readonly)) {
83 print "Error: instance in read-only mode\n";
84 exit(1);
85}
86
87
88
89exit($error);
dol_getmypid()
Return getmypid() or random PID when function is disabled Some web hosts disable this php function fo...
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.