2020-04-13 15:30:52 +02:00
|
|
|
<?php
|
|
|
|
|
|
2022-12-22 21:50:01 +01:00
|
|
|
use Smarty\Exception;
|
2022-12-22 21:23:22 +01:00
|
|
|
use Smarty\Template\Cached;
|
|
|
|
|
|
2023-01-02 00:49:38 +01:00
|
|
|
require_once __DIR__ . '/../../../__shared/cacheresources/cacheresource.mysql.php';
|
2020-04-13 15:30:52 +02:00
|
|
|
|
|
|
|
|
class Smarty_CacheResource_Mysqltest extends Smarty_CacheResource_Mysql
|
|
|
|
|
{
|
|
|
|
|
public $lockTime = 0;
|
|
|
|
|
|
2023-01-03 17:10:02 +01:00
|
|
|
protected function db(): PDO {
|
|
|
|
|
return PHPUnit_Smarty::$pdo;
|
|
|
|
|
}
|
2020-04-13 15:30:52 +02:00
|
|
|
|
2023-01-03 17:10:02 +01:00
|
|
|
public function hasLock(\Smarty\Smarty $smarty, Cached $cached)
|
2020-04-13 15:30:52 +02:00
|
|
|
{
|
|
|
|
|
if ($this->lockTime) {
|
|
|
|
|
$this->lockTime--;
|
|
|
|
|
if (!$this->lockTime) {
|
|
|
|
|
$this->releaseLock($smarty, $cached);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return parent::hasLock($smarty, $cached);
|
|
|
|
|
}
|
|
|
|
|
}
|