/**
  * Central method for making a POST operation against this Solr Server
  *
  * @param string $url
  * @param string $rawPost
  * @param bool|float $timeout Read timeout in seconds
  * @param string $contentType
  * @return Apache_Solr_Response
  */
 protected function _sendRawPost($url, $rawPost, $timeout = FALSE, $contentType = 'text/xml; charset=UTF-8')
 {
     try {
         $response = parent::_sendRawPost($url, $rawPost, $timeout, $contentType);
     } catch (Apache_Solr_HttpTransportException $e) {
         $response = $e->getResponse();
     }
     if (Mage::getStoreConfig('log/query/rawPost')) {
         $logData = array('query url' => $url, 'content' => $rawPost, 'response' => (array) $response);
         if (!empty($e)) {
             $logData['exception'] = $e->__toString();
         }
         Mage::helper('solr')->getLogger()->debug('Querying Solr using POST', $logData);
     }
     return $response;
 }
 /**
  * Central method for making a post operation against this Solr Server
  *
  * @param string $url
  * @param string $rawPost
  * @param float $timeout Read timeout in seconds
  * @param string $contentType
  * @return Apache_Solr_Response
  *
  * @throws Exception If a non 200 response status is returned
  */
 protected function _sendRawPost($url, $rawPost, $timeout = FALSE, $contentType = 'text/xml; charset=UTF-8')
 {
     stream_context_set_option($this->_postContext, 'http', 'header', "Authorization: Basic " . base64_encode($this->getUserLogin() . ':' . $this->getPassword()));
     return parent::_sendRawPost($url, $rawPost, $timeout, $contentType);
 }
Ejemplo n.º 3
0
 /**
  * Central method for making a post operation against this Solr Server
  *
  * @param string $url
  * @param string $rawPost
  * @param float|boolean $timeout Read timeout in seconds
  * @param string $contentType
  * @return \Apache_Solr_Response
  */
 protected function _sendRawPost($url, $rawPost, $timeout = FALSE, $contentType = 'text/xml; charset=UTF-8')
 {
     $logSeverity = 0;
     // info
     try {
         $response = parent::_sendRawPost($url, $rawPost, $timeout, $contentType);
     } catch (\Apache_Solr_HttpTransportException $e) {
         $logSeverity = 3;
         // fatal error
         $response = $e->getResponse();
     }
     if ($GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['logging.']['query.']['rawPost'] || $response->getHttpStatus() != 200) {
         $logData = array('query url' => $url, 'content' => $rawPost, 'response' => (array) $response);
         if (!empty($e)) {
             $logData['exception'] = $e->__toString();
         }
         GeneralUtility::devLog('Querying Solr using POST', 'solr', $logSeverity, $logData);
     }
     return $response;
 }
Ejemplo n.º 4
0
 /**
  * Central method for making a post operation against this Solr Server
  *
  * @param string $url
  * @param string $rawPost
  * @param float|boolean $timeout Read timeout in seconds
  * @param string $contentType
  * @return \Apache_Solr_Response
  */
 protected function _sendRawPost($url, $rawPost, $timeout = false, $contentType = 'text/xml; charset=UTF-8')
 {
     $logSeverity = 0;
     // info
     try {
         $response = parent::_sendRawPost($url, $rawPost, $timeout, $contentType);
     } catch (\Apache_Solr_HttpTransportException $e) {
         $logSeverity = 3;
         // fatal error
         $response = $e->getResponse();
     }
     if ($this->configuration->getLoggingQueryRawPost() || $response->getHttpStatus() != 200) {
         $logData = array('query url' => $url, 'content' => $rawPost, 'response' => (array) $response);
         if (!empty($e)) {
             $logData['exception'] = $e->__toString();
         }
         GeneralUtility::devLog('Querying Solr using POST', 'solr', $logSeverity, $logData);
     }
     return $response;
 }
 /**
  * Central method for making a post operation against this Solr Server
  *
  * @param	string	$url
  * @param	string	$rawPost
  * @param	float	$timeout Read timeout in seconds
  * @param	string	$contentType
  * @return	Apache_Solr_Response
  */
 protected function _sendRawPost($url, $rawPost, $timeout = FALSE, $contentType = 'text/xml; charset=UTF-8')
 {
     $logSeverity = 0;
     // info
     try {
         $response = parent::_sendRawPost($url, $rawPost, $timeout, $contentType);
     } catch (Apache_Solr_HttpTransportException $e) {
         $logSeverity = 3;
         // fatal error
     }
     if ($GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['logging.']['query.']['rawPost']) {
         t3lib_div::devLog('Querying Solr using POST', 'tx_solr', $logSeverity, array('query url' => $url, 'content' => $rawPost, 'response' => (array) $response));
     }
     return $response;
 }