Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
locker.php
1
<?
2
namespace
Bitrix\Main\Composite\Internals
;
3
4
use
Bitrix\Main\Application
;
5
use
Bitrix\Main\DB\MysqlCommonConnection
;
6
7
class
Locker
8
{
9
const
CONNECTION_NAME
=
"composite"
;
10
18
public
static
function
lock
($id)
19
{
20
$result =
true
;
21
$connection = static::getConnection();
22
if
($connection instanceof
MysqlCommonConnection
)
23
{
24
$result = $connection->lock($id);
25
}
26
27
return
$result;
28
}
29
37
public
static
function
unlock
($id)
38
{
39
$connection = static::getConnection();
40
if
($connection instanceof
MysqlCommonConnection
)
41
{
42
$connection->unlock($id);
43
}
44
45
return
true
;
46
}
47
52
private
static
function
getConnection()
53
{
54
$pool =
Application::getInstance
()->getConnectionPool();
55
$connection = $pool->getConnection(static::CONNECTION_NAME);
56
if
(!$connection)
57
{
58
$connection = $pool->cloneConnection(
59
$pool::DEFAULT_CONNECTION_NAME,
60
static::CONNECTION_NAME
61
);
62
}
63
64
return
$connection;
65
}
66
67
}
Bitrix\Main\Application
Definition
application.php:28
Bitrix\Main\Application\getInstance
static getInstance()
Definition
application.php:95
Bitrix\Main\Composite\Internals\Locker
Definition
locker.php:8
Bitrix\Main\Composite\Internals\Locker\CONNECTION_NAME
const CONNECTION_NAME
Definition
locker.php:9
Bitrix\Main\Composite\Internals\Locker\unlock
static unlock($id)
Definition
locker.php:37
Bitrix\Main\Composite\Internals\Locker\lock
static lock($id)
Definition
locker.php:18
Bitrix\Main\DB\MysqlCommonConnection
Definition
mysqlcommonconnection.php:9
Bitrix\Main\Composite\Internals
Definition
automaticarea.php:2
modules
main
lib
composite
internals
locker.php
Создано системой
1.10.0