You are here

public function UpdateHelper::testUpdate in Evercurrent 8.2

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

Test sending an update to the server.

Parameters

string $key: The key to validate against.

Return value

bool Success status.

File

src/UpdateHelper.php, line 278

Class

UpdateHelper
Default UpdateHelper instantiation.

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->configFactory
    ->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;
}