annotate core/lib/Drupal/Core/Lock/PersistentDatabaseLockBackend.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\Core\Lock;
Chris@0 4
Chris@0 5 use Drupal\Core\Database\Connection;
Chris@0 6
Chris@0 7 /**
Chris@0 8 * Defines the persistent database lock backend. This backend is global for this
Chris@0 9 * Drupal installation.
Chris@0 10 *
Chris@0 11 * @ingroup lock
Chris@0 12 */
Chris@0 13 class PersistentDatabaseLockBackend extends DatabaseLockBackend {
Chris@0 14
Chris@0 15 /**
Chris@0 16 * Constructs a new PersistentDatabaseLockBackend.
Chris@0 17 *
Chris@0 18 * @param \Drupal\Core\Database\Connection $database
Chris@0 19 * The database connection.
Chris@0 20 */
Chris@0 21 public function __construct(Connection $database) {
Chris@0 22 // Do not call the parent constructor to avoid registering a shutdown
Chris@0 23 // function that releases all the locks at the end of a request.
Chris@0 24 $this->database = $database;
Chris@0 25 // Set the lockId to a fixed string to make the lock ID the same across
Chris@0 26 // multiple requests. The lock ID is used as a page token to relate all the
Chris@0 27 // locks set during a request to each other.
Chris@0 28 // @see \Drupal\Core\Lock\LockBackendInterface::getLockId()
Chris@0 29 $this->lockId = 'persistent';
Chris@0 30 }
Chris@0 31
Chris@0 32 }