From 31e84f478d0b164434ce2de0a04e2dd0ddc217d9 Mon Sep 17 00:00:00 2001 From: rsgrinko Date: Fri, 24 Jul 2026 19:28:17 +0300 Subject: [PATCH] =?UTF-8?q?=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D1=80=D0=B0=D0=B7=D0=B4=D0=B5=D0=BB=D0=B0=20Nginx=20?= =?UTF-8?q?=D0=BB=D0=BE=D0=B3=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/inc/header.php | 1 - admin/nginx.php | 96 ------------------- .../Core/Helpers/SystemFunctions.class.php | 57 ----------- 3 files changed, 154 deletions(-) delete mode 100644 admin/nginx.php diff --git a/admin/inc/header.php b/admin/inc/header.php index 289d2fc..4b5c0c7 100644 --- a/admin/inc/header.php +++ b/admin/inc/header.php @@ -256,7 +256,6 @@
  • Кэширование
  • Диспетчер очереди
  • Командная PHP строка
  • -
  • Логи nginx
  • В никуда
  • diff --git a/admin/nginx.php b/admin/nginx.php deleted file mode 100644 index 1ec5cea..0000000 --- a/admin/nginx.php +++ /dev/null @@ -1,96 +0,0 @@ - - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - use Core\Helpers\Pagination; - use Core\Helpers\SystemFunctions; - use Core\SystemConfig; - - require_once __DIR__ . '/inc/header.php'; - - global $USER; - if ($USER->isAdmin() === false) { - header('Location: ./'); - die(); - } -?> - - -
    - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    IPДатаЗапросКодРазмерURLБраузер
    -
    - -
    -
    - -
    - \ No newline at end of file diff --git a/core/lib/Core/Helpers/SystemFunctions.class.php b/core/lib/Core/Helpers/SystemFunctions.class.php index 457cf11..ed25657 100644 --- a/core/lib/Core/Helpers/SystemFunctions.class.php +++ b/core/lib/Core/Helpers/SystemFunctions.class.php @@ -686,63 +686,6 @@ return $count; } - /** - * Парсинг логов nginx - * - * @param string $logPath Путь до файла логов - * @param bool $isOnlyCount Только получение количества - * @param string|null $limit Ограничение выборки "0, 10" - * @param bool $isReverse Перевернуть выборку - * - * @return array|int - * @throws CoreException - */ - public static function getNginxLogData(string $logPath, bool $isOnlyCount = false, ?string $limit = null, bool $isReverse = false) - { - if (!file_exists($logPath)) { - throw new CoreException('Файл логов не найден', CoreException::ERROR_FILE_NOT_FOUND); - } - $arLogs = file($logPath); - $logCount = count($arLogs); - if ($isOnlyCount) { - return $logCount; - } - if ($isReverse) { - $arLogs = array_reverse($arLogs); - } - $arLimit = [0, $logCount]; - if ($limit !== null) { - $arLimit['start'] = (int)explode(',', $limit)[0]; - $arLimit['stop'] = $arLimit['start'] + (int)explode(',', $limit)[1]; - } - $regExp = '/(?[0-9.]+)\s+\-\s+\-\s\[(?[^\]]+)\]\s"(?[^"]+)"\s(?\d+)\s+(?\d+)\s"(?[^"]+)"\s"(?[^"]+)"/m'; - $arResult = []; - $result = null; - $counter = 0; - foreach ($arLogs as $logEvent) { - $counter++; - if ($limit !== null && ($counter - 1) < $arLimit['start']) { - continue; - } - preg_match_all($regExp, $logEvent, $result, PREG_SET_ORDER, 0); - $result = array_shift($result); - $arResult[] = [ - 'ip' => $result['ip'], - 'date' => $result['date'], - 'request' => $result['request'], - 'httpCode' => $result['code'], - 'size' => $result['size'], - 'url' => $result['url'], - 'userAgent' => $result['useragent'], - ]; - $result = null; - if ($limit !== null && ($counter + 1) > $arLimit['stop']) { - break; - } - } - return $arResult; - } - /** * Возвращает подсвеченную PHP строку *