/** * Generates the headers to be send with the request. * * @return array Array of HTTP headers. */ public function getHeaders() { $headers = $this->header; $headers[] = TYPO3_user_agent; $itemId = $this->indexQueueItem->getIndexQueueUid(); $indexerRequestData = array('requestId' => $this->requestId, 'item' => $itemId, 'actions' => implode(',', $this->actions), 'hash' => md5($itemId . '|' . $pageId . '|' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])); $indexerRequestData = array_merge($indexerRequestData, $this->parameters); $headers[] = 'X-Tx-Solr-Iq: ' . json_encode($indexerRequestData); if (!empty($this->username) && !empty($this->password)) { $headers[] = 'Authorization: Basic ' . base64_encode($this->username . ':' . $this->password); } return $headers; }
/** * Marks an item as failed and causes the indexer to skip the item in the * next run. * * @param int|Tx_Solr_IndexQueue_Item $item Either the item's Index Queue * uid or the complete item * @param string $errorMessage Error message */ public function markItemAsFailed($item, $errorMessage = '') { $itemUid = 0; if ($item instanceof Tx_Solr_IndexQueue_Item) { $itemUid = $item->getIndexQueueUid(); } else { $itemUid = (int) $item; } if (empty($errorMessage)) { // simply set to "TRUE" $errorMessage = '1'; } $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_solr_indexqueue_item', 'uid = ' . $itemUid, array('errors' => $errorMessage)); }