реализована работа крона через cli

This commit is contained in:
rsgrinko committed 2022-07-10 10:38:54 +03:00
1 parent a996498a30
commit 265ffda21d
2 files changed
+11 -3

No files matched your search

+3
View File
@@ -2,6 +2,9 @@
@ignore_user_abort(true); @ignore_user_abort(true);
set_time_limit(0); set_time_limit(0);
if (empty($_SERVER['DOCUMENT_ROOT'])) {
$_SERVER['DOCUMENT_ROOT'] = __DIR__ . '/..';
}
require_once __DIR__ . '/bootstrap.php'; require_once __DIR__ . '/bootstrap.php';
use Core\Helpers\SystemFunctions; use Core\Helpers\SystemFunctions;
@@ -65,7 +65,12 @@
*/ */
public static function getOS(): string public static function getOS(): string
{ {
$userAgent = $_SERVER['HTTP_USER_AGENT']; $undefinedOS = 'Unknown OS';
if(empty($_SERVER['HTTP_USER_AGENT'])) {
return $undefinedOS;
}
$oses = [ $oses = [
'iOS' => '/(iPhone)|(iPad)/i', 'iOS' => '/(iPhone)|(iPad)/i',
'Windows 3.11' => '/Win16/i', 'Windows 3.11' => '/Win16/i',
@@ -93,11 +98,11 @@
]; ];
foreach ($oses as $os => $pattern) { foreach ($oses as $os => $pattern) {
if (preg_match($pattern, $userAgent)) { if (preg_match($pattern, $_SERVER['HTTP_USER_AGENT'])) {
return $os; return $os;
} }
} }
return 'Unknown OS'; return $undefinedOS;
} }
/** /**