function SystemTestController::lockPersist

Same name in other branches
  1. 9 core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php \Drupal\system_test\Controller\SystemTestController::lockPersist()
  2. 8.9.x core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php \Drupal\system_test\Controller\SystemTestController::lockPersist()
  3. 11.x 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 241

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()',
        ];
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.