dolibarr 24.0.0-beta
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";
50require_once DOL_DOCUMENT_ROOT.'/core/lib/functionscli.lib.php';
51require_once DOL_DOCUMENT_ROOT."/contact/class/contact.class.php";
52require_once DOL_DOCUMENT_ROOT."/user/class/user.class.php";
53
54// Global variables
55$version = DOL_VERSION;
56$error = 0;
57$confirmed = 0;
58
59$hookmanager->initHooks(array('cli'));
60
61
62/*
63 * Main
64 */
65
66@set_time_limit(0);
67print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
68dol_syslog($script_file." launched with arg ".implode(',', $argv));
69
70if (!isset($argv[1]) || !$argv[1]) {
71 print "Usage: $script_file option1|option2\n";
72 exit(1);
73}
74
75foreach ($argv as $key => $val) {
76 $reg = array();
77 if (preg_match('/-y$/', $val, $reg)) {
78 $confirmed = 1;
79 }
80}
81
82$now = $argv[1];
83
84if (!empty($dolibarr_main_db_readonly)) {
85 print "Error: instance in read-only mode\n";
86 exit(1);
87}
88
89
90
91exit($error);
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.