Ejemplo n.º 1
0
 /**
  * Finds the FE user groups used on a page including all groups of content
  * elements and groups of records of extensions that have correctly been
  * pushed through tslib_cObj during rendering.
  *
  * @param Tx_Solr_IndexQueue_Item $item Index queue item representing the current page to get the user groups from
  * @param integer $language The sys_language_uid language ID
  * @return array Array of user group IDs
  */
 protected function getAccessGroupsFromContent(Tx_Solr_IndexQueue_Item $item, $language = 0)
 {
     static $accessGroupsCache;
     $accessGroupsCacheEntryId = $item->getRecordUid() . '|' . $language;
     if (!isset($accessGroupsCache[$accessGroupsCacheEntryId])) {
         $request = $this->buildBasePageIndexerRequest();
         $request->setIndexQueueItem($item);
         $request->addAction('findUserGroups');
         $indexRequestUrl = $this->getDataUrl($item, $language);
         $response = $request->send($indexRequestUrl);
         $groups = $response->getActionResult('findUserGroups');
         if (is_array($groups)) {
             $accessGroupsCache[$accessGroupsCacheEntryId] = $groups;
         }
         if ($this->loggingEnabled) {
             t3lib_div::devLog('Page Access Groups', 'solr', 0, array('item' => (array) $item, 'language' => $language, 'index request url' => $indexRequestUrl, 'request' => (array) $request, 'response' => (array) $response, 'groups' => $groups));
         }
     }
     return $accessGroupsCache[$accessGroupsCacheEntryId];
 }
Ejemplo n.º 2
0
 /**
  * Logs the item and what document was created from it
  *
  * @param	Tx_Solr_IndexQueue_Item	The item that is being indexed.
  * @param	array	An array of Solr documents created from the item's data
  * @param	Apache_Solr_Response	The Solr response for the particular index document
  */
 protected function log(Tx_Solr_IndexQueue_Item $item, array $itemDocuments, Apache_Solr_Response $response)
 {
     if (!$this->loggingEnabled) {
         return;
     }
     $message = 'Index Queue indexing ' . $item->getType() . ':' . $item->getRecordUid() . ' - ';
     $severity = 0;
     // info
     // preparing data
     $documents = array();
     foreach ($itemDocuments as $document) {
         $documents[] = (array) $document;
     }
     $logData = array('item' => (array) $item, 'documents' => $documents, 'response' => (array) $response);
     if ($response->getHttpStatus() == 200) {
         $severity = -1;
         $message .= 'Success';
     } else {
         $severity = 3;
         $message .= 'Failure';
         $logData['status'] = $response->getHttpStatus();
         $logData['status message'] = $response->getHttpStatusMessage();
     }
     \TYPO3\CMS\Core\Utility\GeneralUtility::devLog($message, 'solr', $severity, $logData);
 }