예제 #1
0
파일: Indexer.php 프로젝트: punktDe/solr
 /**
  * Enables logging dependent on the configuration of the item's site
  *
  * @param	Tx_Solr_IndexQueue_Item	$item An item being indexed
  * @return	void
  */
 protected function setLogging(Tx_Solr_IndexQueue_Item $item)
 {
     // reset
     $this->loggingEnabled = FALSE;
     $solrConfiguration = Tx_Solr_Util::getSolrConfigurationFromPageId($item->getRootPageUid());
     if (!empty($solrConfiguration['logging.']['indexing']) || !empty($solrConfiguration['logging.']['indexing.']['queue']) || !empty($solrConfiguration['logging.']['indexing.']['queue.'][$item->getIndexingConfigurationName()])) {
         $this->loggingEnabled = TRUE;
     }
 }
 /**
  * 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	Tx_Solr_IndexQueue_Item	$item Index Queue item to use to determine the host.
  */
 protected function initializeHttpHost(Tx_Solr_IndexQueue_Item $item)
 {
     static $hosts = array();
     // relevant for realURL environments, only
     if (t3lib_extMgm::isLoaded('realurl')) {
         $rootpageId = $item->getRootPageUid();
         $hostFound = !empty($hosts[$rootpageId]);
         if (!$hostFound) {
             $rootline = t3lib_BEfunc::BEgetRootLine($rootpageId);
             $host = t3lib_BEfunc::firstDomainRecord($rootline);
             $hosts[$rootpageId] = $host;
         }
         $_SERVER['HTTP_HOST'] = $hosts[$rootpageId];
     }
 }