
| Current Path : /var/www/html/rocksensor/web/core/modules/system/tests/modules/hold_test/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor/web/core/modules/system/tests/modules/hold_test/hold_test.module |
<?php
/**
* @file
* Contains functions for testing hold request/response.
*/
use Drupal\hold_test\EventSubscriber\HoldTestSubscriber;
/**
* Request hold.
*
* @param bool $status
* TRUE - enable hold, FALSE - disable hold.
*/
function hold_test_request($status) {
$site_path = \Drupal::getContainer()->getParameter('site.path');
file_put_contents($site_path . '/hold_test_request.txt', $status);
// If we're releasing the hold wait for a bit to allow the subscriber to read
// the file.
if (!$status) {
usleep(HoldTestSubscriber::WAIT * 2);
}
}
/**
* Response hold.
*
* @param bool $status
* TRUE - enable hold, FALSE - disable hold.
*/
function hold_test_response($status) {
$site_path = \Drupal::getContainer()->getParameter('site.path');
file_put_contents($site_path . '/hold_test_response.txt', $status);
// If we're releasing the hold wait for a bit to allow the subscriber to read
// the file.
if (!$status) {
usleep(HoldTestSubscriber::WAIT * 2);
}
}