/** * Initializes the $_SERVER['HTTP_HOST'] environment variable in CLI * environments dependent on the Index Queue item's root page. * * When the Index Queue Worker task is executed by a cron job there is no * HTTP_HOST since we are in a CLI environment. RealURL needs the host * information to generate a proper URL though. Using the Index Queue item's * root page information we can determine the correct host although being * in a CLI environment. * * @param Item $item Index Queue item to use to determine the host. */ protected function initializeHttpHost(Item $item) { static $hosts = array(); $rootpageId = $item->getRootPageUid(); $hostFound = !empty($hosts[$rootpageId]); if (!$hostFound) { $rootline = BackendUtility::BEgetRootLine($rootpageId); $host = BackendUtility::firstDomainRecord($rootline); $hosts[$rootpageId] = $host; } $_SERVER['HTTP_HOST'] = $hosts[$rootpageId]; // needed since TYPO3 7.5 GeneralUtility::flushInternalRuntimeCaches(); }
/** * Enables logging dependent on the configuration of the item's site * * @param Item $item An item being indexed * @return void */ protected function setLogging(Item $item) { // reset $this->loggingEnabled = FALSE; $solrConfiguration = Util::getSolrConfigurationFromPageId($item->getRootPageUid()); if (!empty($solrConfiguration['logging.']['indexing']) || !empty($solrConfiguration['logging.']['indexing.']['queue']) || !empty($solrConfiguration['logging.']['indexing.']['queue.'][$item->getIndexingConfigurationName()])) { $this->loggingEnabled = TRUE; } }
/** * Enables logging dependent on the configuration of the item's site * * @param Item $item An item being indexed * @return void */ protected function setLogging(Item $item) { $solrConfiguration = Util::getSolrConfigurationFromPageId($item->getRootPageUid()); $this->loggingEnabled = $solrConfiguration->getLoggingIndexingQueueOperationsByConfigurationNameWithFallBack($item->getIndexingConfigurationName()); }
/** * Initializes the $_SERVER['HTTP_HOST'] environment variable in CLI * environments dependent on the Index Queue item's root page. * * When the Index Queue Worker task is executed by a cron job there is no * HTTP_HOST since we are in a CLI environment. RealURL needs the host * information to generate a proper URL though. Using the Index Queue item's * root page information we can determine the correct host although being * in a CLI environment. * * @param Item $item Index Queue item to use to determine the host. */ protected function initializeHttpHost(Item $item) { static $hosts = array(); // relevant for realURL environments, only if (ExtensionManagementUtility::isLoaded('realurl')) { $rootpageId = $item->getRootPageUid(); $hostFound = !empty($hosts[$rootpageId]); if (!$hostFound) { $rootline = BackendUtility::BEgetRootLine($rootpageId); $host = BackendUtility::firstDomainRecord($rootline); $hosts[$rootpageId] = $host; } $_SERVER['HTTP_HOST'] = $hosts[$rootpageId]; } }
/** * Initializes the $_SERVER['HTTP_HOST'] environment variable in CLI * environments dependent on the Index Queue item's root page. * * When the Index Queue Worker task is executed by a cron job there is no * HTTP_HOST since we are in a CLI environment. RealURL needs the host * information to generate a proper URL though. Using the Index Queue item's * root page information we can determine the correct host although being * in a CLI environment. * * @param Item $item Index Queue item to use to determine the host. */ protected function initializeHttpHost(Item $item) { static $hosts = array(); // relevant for realURL environments, only if (ExtensionManagementUtility::isLoaded('realurl')) { $rootpageId = $item->getRootPageUid(); $hostFound = !empty($hosts[$rootpageId]); if (!$hostFound) { $rootline = BackendUtility::BEgetRootLine($rootpageId); $host = BackendUtility::firstDomainRecord($rootline); $hosts[$rootpageId] = $host; } $_SERVER['HTTP_HOST'] = $hosts[$rootpageId]; if (version_compare(TYPO3_branch, '7.5', '>=')) { GeneralUtility::flushInternalRuntimeCaches(); } } }