You are here

function nodejs_server_has_update in Node.js integration 7

Checks if the node.js server app has an update.

1 call to nodejs_server_has_update()
nodejs_requirements in ./nodejs.install
Implements hook_requirements()

File

./nodejs.module, line 787

Code

function nodejs_server_has_update() {
  $response = drupal_http_request(NODEJS_SERVER_NPM_URL);
  if (isset($response->error)) {
    return FALSE;
  }
  $npm_data = json_decode($response->data);
  $server_version = Nodejs::getServerVersion();
  if ($server_version && isset($npm_data->{'dist-tags'}->latest) && $npm_data->{'dist-tags'}->latest != $server_version) {
    return TRUE;
  }
  return FALSE;
}