You are here

public function WSServer::disable in Web Service Data 2.0.x

Same name and namespace in other branches
  1. 8 src/Entity/WSServer.php \Drupal\wsdata\Entity\WSServer::disable()

Disables the configuration entity.

Return value

$this

Overrides ConfigEntityBase::disable

File

src/Entity/WSServer.php, line 144

Class

WSServer
Defines the Web Service Server entity.

Namespace

Drupal\wsdata\Entity

Code

public function disable($degraded = FALSE) {
  $reason = '';
  if ($degraded) {
    if (!isset($this->state['degraded_backoff'])) {
      $this->state['degraded_backoff'] = wsserver::$WSCONFIG_DEFAULT_DEGRADED_BACKOFF;
    }
    if ($this->state['degraded_backoff'] == 0) {
      return;
    }
    $reason = '  ' . t('Automatically disabled due to degrated service.');
    $this->state['degraded'] = time();
  }
  $this->state['disabled'] = TRUE;
  \Drupal::logger('wsdata')
    ->warning(t('WSServer %label (%type) was disabled.', [
    '%label' => $this
      ->label(),
    '%type' => $this->wsconnector,
  ]) . $reason);
}