Loading nodejs.install +40 −0 Changes for nodejs.install: 40 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -47,3 +47,43 @@ function nodejs_schema() { ); } /** * Implements hook_requirements() */ function nodejs_requirements($phase) { if ($phase == 'runtime') { $result = array(); $requirements['nodejs'] = array( 'title' => t('Node.js'), 'description' => t('Can Drupal connect to the Node.js server?'), ); // Initiate a call to the Nodejs server // and react to the response. $message = new StdClass; $response = Nodejs::sendMessage($message); // drupal_http_request does the work for us so we just check to see // if it is an error or not and report back // $response->error: If an error occurred, the error message. Otherwise not set. if (isset($response->error)) { $result = array( 'value' => check_plain($response->error), 'severity' => REQUIREMENT_ERROR, ); } else { $result = array( 'value' => check_plain($response->status_message), 'severity' => REQUIREMENT_OK, ); } // Merge the result from Nodejs $requirements['nodejs'] += $result; return $requirements; } } nodejs.module +2 −0 Changes for nodejs.module: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -672,6 +672,8 @@ class Nodejs { 'method' => 'POST', 'data' => drupal_json_encode($message), 'headers' => self::$headers, // This is server to server, so start with a low default timeout. 'timeout' => !empty(self::$config['timeout']) ? self::$config['timeout'] : 5, ); return drupal_http_request(self::$baseUrl . 'nodejs/publish', $options); } Loading Loading
nodejs.install +40 −0 Changes for nodejs.install: 40 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -47,3 +47,43 @@ function nodejs_schema() { ); } /** * Implements hook_requirements() */ function nodejs_requirements($phase) { if ($phase == 'runtime') { $result = array(); $requirements['nodejs'] = array( 'title' => t('Node.js'), 'description' => t('Can Drupal connect to the Node.js server?'), ); // Initiate a call to the Nodejs server // and react to the response. $message = new StdClass; $response = Nodejs::sendMessage($message); // drupal_http_request does the work for us so we just check to see // if it is an error or not and report back // $response->error: If an error occurred, the error message. Otherwise not set. if (isset($response->error)) { $result = array( 'value' => check_plain($response->error), 'severity' => REQUIREMENT_ERROR, ); } else { $result = array( 'value' => check_plain($response->status_message), 'severity' => REQUIREMENT_OK, ); } // Merge the result from Nodejs $requirements['nodejs'] += $result; return $requirements; } }
nodejs.module +2 −0 Changes for nodejs.module: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -672,6 +672,8 @@ class Nodejs { 'method' => 'POST', 'data' => drupal_json_encode($message), 'headers' => self::$headers, // This is server to server, so start with a low default timeout. 'timeout' => !empty(self::$config['timeout']) ? self::$config['timeout'] : 5, ); return drupal_http_request(self::$baseUrl . 'nodejs/publish', $options); } Loading