Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/yandex.market/lib/utils/ |
Upload File : |
<?php namespace Yandex\Market\Utils; use Bitrix\Main; use Yandex\Market; class Trace { public static function getTraceUntil($functionName) { $functionNameLower = Market\Data\TextString::toLower($functionName); $trace = Main\Diag\Helper::getBackTrace(20, DEBUG_BACKTRACE_IGNORE_ARGS); $isFoundCall = false; $result = []; foreach ($trace as $traceLevel) { if ($isFoundCall) { $result[] = $traceLevel; } else if (Market\Data\TextString::toLower($traceLevel['function']) === $functionNameLower) { $isFoundCall = true; $result[] = $traceLevel; } } return $result; } public static function formatTrace($trace) { $result = ''; foreach ($trace as $traceNum => $traceInfo) { $traceLine = '#' . $traceNum . ': '; if (array_key_exists('class', $traceInfo)) { $traceLine .= $traceInfo['class'] . $traceInfo['type']; } if (array_key_exists('function', $traceInfo)) { $traceLine .= $traceInfo['function']; } $traceLine .= "\n\t" . $traceInfo['file'] . ':' . $traceInfo['line']; $result .= $traceLine . "\n"; } return $result; } public static function getLevelData($traceLevel) { $filePath = Main\IO\Path::normalize($traceLevel['file']); $docRoot = Main\IO\Path::normalize($_SERVER['DOCUMENT_ROOT']); $moduleName = null; if (Market\Data\TextString::getPosition($filePath, $docRoot) === 0) { $docRoot = rtrim($docRoot, '/'); $filePath = Market\Data\TextString::getSubstring( $filePath, Market\Data\TextString::getLength($docRoot) ); } if (preg_match('#(?:' . BX_ROOT . '|local)/modules/(.*?)/#i', $filePath, $matches) && Main\ModuleManager::isModuleInstalled($matches[1])) { $moduleName = $matches[1]; } return array_filter([ 'file' => $filePath, 'line' => $traceLevel['line'], 'function' => $traceLevel['function'], 'module' => $moduleName, ]); } }