r86879 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86878‎ | r86879 | r86880 >
Date:18:42, 25 April 2011
Author:mkroetzsch
Status:deferred
Tags:
Comment:
act more gracefully when receiving an empty response (happens when 4Store crashes)
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/sparql/SMW_SparqlDatabase.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/sparql/SMW_SparqlDatabase.php
@@ -324,7 +324,7 @@
325325 * @return SMWSparqlResultWrapper
326326 */
327327 public function doQuery( $sparql ) {
328 - debug_zval_dump( $sparql );
 328+ //debug_zval_dump( $sparql );
329329 curl_setopt( $this->m_curlhandle, CURLOPT_URL, $this->m_queryEndpoint );
330330 curl_setopt( $this->m_curlhandle, CURLOPT_POST, true );
331331 $parameterString = "query=" . urlencode( $sparql );
@@ -459,6 +459,8 @@
460460 }
461461 } elseif ( $error == CURLE_COULDNT_CONNECT ) {
462462 return; // fail gracefully if backend is down
 463+ } elseif ( $error == 52 ) { // 52 == CURLE_GOT_NOTHING, but this constant is not defined in PHP, it seems
 464+ return; // happens when 4Store crashes, do not bother the wiki
463465 } else {
464466 throw new Exception( "Failed to communicate with SPARQL store.\n Endpoint: " . $endpoint . "\n Curl error: '" . curl_error( $this->m_curlhandle ) . "' ($error)" );
465467 }

Status & tagging log