4use \Bitrix\Main\Entity;
5use \Bitrix\Main\ORM\Query\Result as QueryResult;
6use \Bitrix\Landing\Internals\LockTable;
32 protected static function isEntityLocked(
int $entityId,
string $entityType,
string $lockType): bool
34 return LockTable::getList([
39 'ENTITY_ID' => $entityId,
40 '=ENTITY_TYPE' => $entityType,
41 '=LOCK_TYPE' => $lockType
43 ])->fetch() ? true :
false;
54 protected static function lockEntity(
int $entityId,
string $entityType,
string $lockType,
bool $lock =
true): bool
56 $current = LockTable::getList([
61 'ENTITY_ID' => $entityId,
62 '=ENTITY_TYPE' => $entityType,
63 '=LOCK_TYPE' => $lockType
66 if (!$lock && isset($current[
'ID']))
68 return LockTable::delete($current[
'ID'])->isSuccess();
70 if ($lock && !isset($current[
'ID']))
72 return LockTable::add([
73 'ENTITY_ID' => $entityId,
74 'ENTITY_TYPE' => $entityType,
75 'LOCK_TYPE' => $lockType
88 if (self::isEntityLocked($siteId, self::ENTITY_TYPE_SITE, self::LOCK_TYPE_DELETE))
93 return LockTable::getList([
98 'LANDING.SITE_ID' => $siteId,
99 '=ENTITY_TYPE' => self::ENTITY_TYPE_LANDING,
100 '=LOCK_TYPE' => self::LOCK_TYPE_DELETE
103 new Entity\ReferenceField(
105 'Bitrix\Landing\Internals\LandingTable',
107 '=this.ENTITY_ID' =>
'ref.ID',
108 '=this.ENTITY_TYPE' => [
109 '?', self::ENTITY_TYPE_LANDING
114 ])->fetch() ? true :
false;
135 if (Site::ping($siteId, !$lock))
137 return self::lockEntity($siteId, self::ENTITY_TYPE_SITE, self::LOCK_TYPE_DELETE, $lock);
150 if (Landing::ping($landingId, !$lock))
152 return self::lockEntity($landingId, self::ENTITY_TYPE_LANDING, self::LOCK_TYPE_DELETE, $lock);
162 public static function getList(array $params = []): QueryResult
164 return LockTable::getList($params);
static lockDeleteSite(int $siteId, bool $lock=true)
static isSiteDeleteLocked(int $siteId)
static isEntityLocked(int $entityId, string $entityType, string $lockType)
static getList(array $params=[])
static isLandingDeleteLocked(int $landingId)
static lockEntity(int $entityId, string $entityType, string $lockType, bool $lock=true)
const ENTITY_TYPE_LANDING
static lockDeleteLanding(int $landingId, bool $lock=true)