/** * Logs debug info by Diag. * @throws \Bitrix\Main\SystemException * @return void */ protected function logDebugInfo() { if ($this->collectDebugInfo) { Diag::getInstance()->logDebugInfo(get_called_class()); } }
public function executeComponent() { try { /* if (IsModuleInstalled("disk")) { \Bitrix\Disk\Internals\Diag::getInstance() // ->setExclusiveUserId(45) ->setEnableTimeTracker(true) ->setMemoryBehavior(\Bitrix\Disk\Internals\Diag::MEMORY_PRINT_DIFF) ->setSqlBehavior(\Bitrix\Disk\Internals\Diag::SQL_COUNT) ->collectDebugInfo($this->componentId, $this->getName()); } */ $this->checkRequiredParams(); $this->feed = new \Bitrix\Forum\Comments\Feed($this->arParams["FORUM_ID"], array("type" => $this->arParams["ENTITY_TYPE"], "id" => $this->arParams["ENTITY_ID"], "xml_id" => $this->arParams["ENTITY_XML_ID"])); $this->forum = $this->feed->getForum(); if (array_key_exists("PERMISSION", $this->arParams)) { $this->feed->setPermission($this->arParams["PERMISSION"]); } if (array_key_exists("ALLOW_EDIT_OWN_MESSAGE", $this->arParams)) { $this->feed->setEditOwn($this->arParams["ALLOW_EDIT_OWN_MESSAGE"] == "ALL" || $this->arParams["ALLOW_EDIT_OWN_MESSAGE"] === "LAST"); } $this->arParams["ALLOW_EDIT_OWN_MESSAGE"] = $this->feed->getEntity()->canEditOwn() ? "ALL" : "N"; if (!$this->errorCollection->hasErrors() && $this->feed->canRead()) { $this->bindObjects(); $this->prepareParams(); foreach (GetModuleEvents('forum', 'OnCommentsInit', true) as $arEvent) { ExecuteModuleEventEx($arEvent, array(&$this)); } if (!$this->checkPreview() && $this->checkActions() === false) { foreach (GetModuleEvents('forum', 'OnCommentError', true) as $arEvent) { ExecuteModuleEventEx($arEvent, array(&$this)); } } ob_start(); $this->__includeComponent(); $output = ob_get_clean(); foreach (GetModuleEvents('forum', 'OnCommentsDisplayTemplate', true) as $arEvent) { ExecuteModuleEventEx($arEvent, array(&$output, $this->arParams, $this->arResult)); } echo $output; } else { $this->showError(); } if (IsModuleInstalled("disk")) { \Bitrix\Disk\Internals\Diag::getInstance()->logDebugInfo($this->componentId, $this->getName()); } } catch (Exception $e) { $this->handleException($e); } }
private function resolvePath(Storage $storage, $path, $lookUpFromFolderId, $lastPart = FolderTable::TYPE_FOLDER) { Diag::getInstance()->collectDebugInfo('urlmanager'); $path = trim($path, '/'); $relativeItems = array(); if ($path == 'index.php' || !$path) { if ($lastPart == FolderTable::TYPE_FILE) { return null; } //by default we show root folder. return array('STORAGE' => $storage, 'OBJECT_ID' => $storage->getRootObjectId(), 'RELATIVE_PATH' => '/', 'RELATIVE_ITEMS' => array()); } $filter = array('TYPE' => FolderTable::TYPE_FOLDER, 'STORAGE_ID' => $storage->getId()); if ($lookUpFromFolderId !== null) { $filter['PARENT_ID'] = $lookUpFromFolderId; } $partsOfPath = explode('/', $path); if (end($partsOfPath) == 'index.php') { array_pop($partsOfPath); } foreach ($partsOfPath as $i => $pieceOfPath) { if ($i === count($partsOfPath) - 1) { if ($lastPart !== null) { $filter['TYPE'] = $lastPart; } else { unset($filter['TYPE']); } } $filter['=NAME'] = $pieceOfPath; $folder = ObjectTable::getList(array('filter' => $filter, 'select' => array('ID', 'NAME', 'REAL_OBJECT_ID', 'STORAGE_ID', 'PARENT_ID')))->fetch(); if (!$folder) { return null; } if ($folder['REAL_OBJECT_ID']) { $filter['PARENT_ID'] = $folder['REAL_OBJECT_ID']; unset($filter['STORAGE_ID']); } else { $filter['PARENT_ID'] = $folder['ID']; $filter['STORAGE_ID'] = $folder['STORAGE_ID']; } $lookUpFromFolderId = $folder['ID']; $relativeItems[] = array('ID' => $folder['ID'], 'NAME' => $pieceOfPath); } unset($pieceOfPath); Diag::getInstance()->logDebugInfo('urlmanager'); return array('STORAGE' => $storage, 'OBJECT_ID' => $lookUpFromFolderId, 'RELATIVE_PATH' => implode('/', $partsOfPath), 'RELATIVE_ITEMS' => $relativeItems); }
public function executeComponent() { try { Diag::getInstance()->collectDebugInfo($this->componentId, $this->getName()); $this->resolveAction(); $this->checkAction(); $this->checkRequiredModules(); $this->prepareParams(); if ($this->processBeforeAction($this->getAction()) !== false) { $this->runAction(); } Diag::getInstance()->logDebugInfo($this->componentId, $this->getName()); } catch (Exception $e) { $this->runProcessingExceptionComponent($e); } }