You are here

public function SystemTestController::lockPersist in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php \Drupal\system_test\Controller\SystemTestController::lockPersist()

Creates a lock that will persist across requests.

Parameters

string $lock_name: The name of the persistent lock to acquire.

Return value

string The text to display.

1 string reference to 'SystemTestController::lockPersist'
system_test.routing.yml in core/modules/system/tests/modules/system_test/system_test.routing.yml
core/modules/system/tests/modules/system_test/system_test.routing.yml

File

core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php, line 201
Contains \Drupal\system_test\Controller\SystemTestController.

Class

SystemTestController
Controller routines for system_test routes.

Namespace

Drupal\system_test\Controller

Code

public function lockPersist($lock_name) {
  if ($this->persistentLock
    ->acquire($lock_name)) {
    return [
      '#markup' => 'TRUE: Lock successfully acquired in SystemTestController::lockPersist()',
    ];
  }
  else {
    return [
      '#markup' => 'FALSE: Lock not acquired in SystemTestController::lockPersist()',
    ];
  }
}