コード例 #1
0
 /**
  * Does the request to the Node server and returns the responseText (empty string on failure).
  */
 private static function makeRequest($params)
 {
     global $wgReadOnly;
     wfProfileIn(__METHOD__);
     $response = "";
     ChatHelper::debug(__METHOD__ . ': Method called ', $params);
     // NOTE: When we fail over, the chat server host doesn't change which backend it points to (since there isn't
     // even a chat server in the backup datacenter(s)), so if we're in read-only, even though this isn't a write
     // operation, abort trying to contact the node server since it could be unavailable (in the event of complete
     // network unavailability in the primary datacenter). - BugzId 11047
     if (empty($wgReadOnly)) {
         $requestUrl = "http://" . NodeApiClient::getHostAndPort() . "/api?" . http_build_query($params);
         $response = Http::get($requestUrl, 'default', array('noProxy' => true));
         if ($response === false) {
             $response = "";
         }
     }
     wfProfileOut(__METHOD__);
     return $response;
 }