uawdijnntqw1x1x1
IP : 3.145.201.49
Hostname : axolotl
Kernel : Linux axolotl 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
OS : Linux
PATH:
/
var
/
www
/
axolotl
/
data
/
www
/
.
/
b24.axolotl.ru
/
public_html
/
bitrix
/
modules
/
landing
/
lib
/
lock.php
/
/
<?php namespace Bitrix\Landing; use \Bitrix\Main\Entity; use \Bitrix\Main\ORM\Query\Result as QueryResult; use \Bitrix\Landing\Internals\LockTable; class Lock { /** * Site entity type. */ const ENTITY_TYPE_SITE = 'S'; /** * Landing entity type. */ const ENTITY_TYPE_LANDING = 'L'; /** * Lock type for 'delete'. */ const LOCK_TYPE_DELETE = 'D'; /** * Returns true if entity is under lock. * @param int $entityId Entity id. * @param string $entityType Entity type. * @param string $lockType Lock type. * @return bool */ protected static function isEntityLocked(int $entityId, string $entityType, string $lockType): bool { return LockTable::getList([ 'select' => [ 'ID' ], 'filter' => [ 'ENTITY_ID' => $entityId, '=ENTITY_TYPE' => $entityType, '=LOCK_TYPE' => $lockType ] ])->fetch() ? true : false; } /** * Locks / unlocks entity. * @param int $entityId Entity id. * @param string $entityType Entity type. * @param string $lockType Lock type. * @param bool $lock Lock or unlock. * @return bool */ protected static function lockEntity(int $entityId, string $entityType, string $lockType, bool $lock = true): bool { $current = LockTable::getList([ 'select' => [ 'ID' ], 'filter' => [ 'ENTITY_ID' => $entityId, '=ENTITY_TYPE' => $entityType, '=LOCK_TYPE' => $lockType ] ])->fetch(); if (!$lock && isset($current['ID'])) { return LockTable::delete($current['ID'])->isSuccess(); } if ($lock && !isset($current['ID'])) { return LockTable::add([ 'ENTITY_ID' => $entityId, 'ENTITY_TYPE' => $entityType, 'LOCK_TYPE' => $lockType ])->isSuccess(); } return true; } /** * Returns true if site is under 'delete' lock. * @param int $siteId Site id. * @return bool */ public static function isSiteDeleteLocked(int $siteId): bool { if (self::isEntityLocked($siteId, self::ENTITY_TYPE_SITE, self::LOCK_TYPE_DELETE)) { return true; } // check status for site's landings return LockTable::getList([ 'select' => [ 'ID' ], 'filter' => [ 'LANDING.SITE_ID' => $siteId, '=ENTITY_TYPE' => self::ENTITY_TYPE_LANDING, '=LOCK_TYPE' => self::LOCK_TYPE_DELETE ], 'runtime' => [ new Entity\ReferenceField( 'LANDING', 'Bitrix\Landing\Internals\LandingTable', [ '=this.ENTITY_ID' => 'ref.ID', '=this.ENTITY_TYPE' => [ '?', self::ENTITY_TYPE_LANDING ] ] ) ] ])->fetch() ? true : false; } /** * Returns true if landing is under 'delete' lock. * @param int $landingId Landing id. * @return bool */ public static function isLandingDeleteLocked(int $landingId): bool { return self::isEntityLocked($landingId, self::ENTITY_TYPE_LANDING, self::LOCK_TYPE_DELETE); } /** * Locks site for delete. * @param int $siteId Site id. * @param bool $lock Lock or unlock. * @return bool */ public static function lockDeleteSite(int $siteId, bool $lock = true): bool { if (Site::ping($siteId, !$lock)) { return self::lockEntity($siteId, self::ENTITY_TYPE_SITE, self::LOCK_TYPE_DELETE, $lock); } return false; } /** * Locks landing for delete. * @param int $landingId Landing id. * @param bool $lock Lock or unlock. * @return bool */ public static function lockDeleteLanding(int $landingId, bool $lock = true): bool { if (Landing::ping($landingId, !$lock)) { return self::lockEntity($landingId, self::ENTITY_TYPE_LANDING, self::LOCK_TYPE_DELETE, $lock); } return false; } /** * Provides ORM queries to LockTable. * @param array $params ORM params. * @return QueryResult */ public static function getList(array $params = []): QueryResult { return LockTable::getList($params); } }
/var/www/axolotl/data/www/./b24.axolotl.ru/public_html/bitrix/modules/landing/lib/lock.php