You are here

public function UpdateHelper::testUpdate in Evercurrent 8

Same name and namespace in other branches
  1. 8.2 src/UpdateHelper.php \Drupal\evercurrent\UpdateHelper::testUpdate()

Test sending an update to the server.

Parameters

$key:

Return value

bool

File

src/UpdateHelper.php, line 251
Contains Drupal\evercurrent\UpdateHelper.

Class

UpdateHelper
Class UpdateHelper.

Namespace

Drupal\evercurrent

Code

public function testUpdate($key) {
  if (!$this
    ->keyCheck($key)) {
    $this
      ->writeStatus(RMH_STATUS_ERROR, 'Failed to set RMH key. Key should be a 32-character string.');
    return FALSE;
  }
  $config = $this->config_factory
    ->getEditable('evercurrent.admin_config');
  $config
    ->set('listen', FALSE);
  $config
    ->set('key', $key);
  $this
    ->writeStatus(RMH_STATUS_OK, 'Key was successfully received.');
  $this
    ->sendUpdates(TRUE);
  return TRUE;
}