Function __destruct
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function __destruct()
{
if (!static::$keepLogFile) {
if (!static::$logActive) {
return;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __construct
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function __construct()
{
static::$scriptTimeStart = microtime(true);
static::generateStatusFile();
if (self::$watchdogIsActive) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The method log has a boolean flag argument $indent, which is a certain sign of a Single Responsibility Principle violation. Open
public function log(string $message, string $level = 'info', bool $indent = true)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Avoid using static access to class 'App\Config' in method '__construct'. Open
if (!(static::$logActive = Config::debug('DEBUG_CRON'))) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Config' in method 'getMaxExecutionTime'. Open
$maxExecutionTime = (int) Config::main('maxExecutionCronTime');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\YetiForce\Watchdog' in method '__construct'. Open
YetiForce\Watchdog::send();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Log' in method '__construct'. Open
Log::error("The mechanism of cron logs has been disabled !!!. No access to the log directory '{$this->logPath}'");
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Utils\ConfReport' in method 'generateStatusFile'. Open
$all = Utils\ConfReport::getAll();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid assigning values to variables in if clauses and the like (line '99', column '9'). Open
public function __construct()
{
static::$scriptTimeStart = microtime(true);
static::generateStatusFile();
if (self::$watchdogIsActive) {
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class 'App\Utils' in method 'generateStatusFile'. Open
return file_put_contents(ROOT_DIRECTORY . '/app_data/cron.php', '<?php return ' . Utils::varExport($all) . ';', LOCK_EX);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method __destruct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->log('------------------------------------' . PHP_EOL . Log::getlastLogs(), 'info', false);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'App\Log' in method '__destruct'. Open
$this->log('------------------------------------' . PHP_EOL . Log::getlastLogs(), 'info', false);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Assigning float
to property but \App\Cron::$scriptTimeStart
is int|null
Open
static::$scriptTimeStart = microtime(true);
- Exclude checks
Call to method getAll
from undeclared class \App\Utils\ConfReport
(Did you mean class \Tests\Settings\ConfReport) Open
$all = Utils\ConfReport::getAll();
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
return (new Db\Query())
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
Db::getInstance()->createCommand()->update('vtiger_cron_task', ['status' => $status], ['name' => $name])->execute();
- Exclude checks
Call to method __construct
from undeclared class \App\YetiForce\Register
Open
(new YetiForce\Register())->send();
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
Log::error("The mechanism of cron logs has been disabled !!!. No access to the log directory '{$this->logPath}'");
- Exclude checks
Call to method getlastLogs
from undeclared class \App\Log
Open
$this->log('------------------------------------' . PHP_EOL . Log::getlastLogs(), 'info', false);
- Exclude checks
Call to method send
from undeclared class \App\YetiForce\Register
Open
(new YetiForce\Register())->send();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var bool Logging enabled flag
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const STATUS_ENABLED = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var bool Flag to keep log file after run finish */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int status enabled
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $scriptTimeStart;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var bool|string Current log file name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const STATUS_RUNNING = 2;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int|null Script run start time in microtime
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $cronTimeStart;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $logPath = ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . 'cache' . \DIRECTORY_SEPARATOR . 'logs' . \DIRECTORY_SEPARATOR . 'cron' . \DIRECTORY_SEPARATOR;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var bool Register enabled flag */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $maxExecutionCronTime;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$all = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return file_put_contents(ROOT_DIRECTORY . '/app_data/cron.php', '<?php return ' . Utils::varExport($all) . ';', LOCK_EX);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Line exceeds 120 characters; contains 157 characters Open
public $logPath = ROOT_DIRECTORY . \DIRECTORY_SEPARATOR . 'cache' . \DIRECTORY_SEPARATOR . 'logs' . \DIRECTORY_SEPARATOR . 'cron' . \DIRECTORY_SEPARATOR;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $shopIsActive = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @throws \App\Exceptions\CacheException
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (self::$watchdogIsActive) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$message = ' ' . $message;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$all['last_start'] = time();
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
return file_put_contents(ROOT_DIRECTORY . '/app_data/cron.php', '<?php return ' . Utils::varExport($all) . ';', LOCK_EX);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getCronExecutionTime()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$maxExecutionTime = $iniMaxExecutionTime;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var bool Watchdog enabled flag */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Init and configure object.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function __construct()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::generateStatusFile();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
YetiForce\Watchdog::send();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$logActive = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int status disabled
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int Max execution cron time. */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
(new YetiForce\Register())->send();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!(static::$logActive = Config::debug('DEBUG_CRON'))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $level information type [info, warning, error]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ((int) $status) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
default:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::$maxExecutionCronTime = $maxExecutionTime;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return time() >= (self::getMaxExecutionTime() + self::$cronTimeStart);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check if it is active function.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logFile = date('Ymd_Hi') . '.log';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Remove log file if no value information was stored.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $indent add three spaces at message begin
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$all = Utils\ConfReport::getAll();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function updateStatus(int $status, string $name): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get max execution cron time.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int status running
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int status completed
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string Log files directory path
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var bool Shop enabled flag */
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
Log::error("The mechanism of cron logs has been disabled !!!. No access to the log directory '{$this->logPath}'");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function __destruct()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Db::getInstance()->createCommand()->update('vtiger_cron_task', ['status' => $status], ['name' => $name])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!static::$keepLogFile) {
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
file_put_contents($this->logPath . $this->logFile, date('Y-m-d H:i:s') . " [{$level}] - {$message}" . PHP_EOL, FILE_APPEND);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!is_dir($this->logPath) && !mkdir($this->logPath, 0777, true) && !is_dir($this->logPath)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Log::error("The mechanism of cron logs has been disabled !!!. No access to the log directory '{$this->logPath}'");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$keepLogFile = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update cron task status by name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $status
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$iniMaxExecutionTime = (int) \ini_get('max_execution_time');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $confReportIsActive = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($indent) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Gather and save information for YetiForce Status module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new Exceptions\AppException('Invalid status');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::$maxExecutionCronTime;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 !== $iniMaxExecutionTime && $iniMaxExecutionTime < $maxExecutionTime) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!static::$logActive) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unlink($this->logPath . $this->logFile);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->log('------------------------------------' . PHP_EOL . Log::getlastLogs(), 'info', false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Add log message.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $message log information
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return float|null
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
Db::getInstance()->createCommand()->update('vtiger_cron_task', ['status' => $status], ['name' => $name])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int|null Cron run start time in microtime
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $logFile = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Calculate current object run time.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check max execution cron time.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Script run start time in microtime.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $logActive = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (self::$registerIsActive) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->logFile) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
file_put_contents($this->logPath . $this->logFile, date('Y-m-d H:i:s') . " [{$level}] - {$message}" . PHP_EOL, FILE_APPEND);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::STATUS_DISABLED:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const STATUS_DISABLED = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Cron run start time in microtime.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $watchdogIsActive = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$scriptTimeStart = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::STATUS_RUNNING:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const STATUS_COMPLETED = 3;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::STATUS_ENABLED:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$maxExecutionTime = (int) Config::main('maxExecutionCronTime');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['status' => [self::STATUS_ENABLED, self::STATUS_RUNNING], 'handler_class' => $className])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $keepLogFile = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $registerIsActive = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var bool ConfReport enabled flag */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!static::$logActive) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('error' === $level) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (self::$confReportIsActive) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getMaxExecutionTime(): int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function checkCronTimeout(): bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->log('File start', 'info', false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (file_exists($this->logPath . $this->logFile)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function log(string $message, string $level = 'info', bool $indent = true)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool|int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function generateStatusFile()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return static::$cronTimeStart ? round(microtime(true) - static::$cronTimeStart, 2) : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset(self::$maxExecutionCronTime)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $className
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('vtiger_cron_task')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function checkActive(string $className): bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return (new Db\Query())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->exists();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks