• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/file.php
  • Класс: BitrixDiskFile
  • Вызов: File::lock
public function lock($lockedBy, $token = null, array $data = array())
{
	if($token === null)
	{
		$token = ObjectLock::generateLockToken();
	}

	//now we work only with exclusive locks.
	$objectLock = $this->getLock();
	if($objectLock)
	{
		$this->errorCollection[] = new Error(
			Loc::getMessage('DISK_FILE_MODEL_ERROR_ALREADY_LOCKED'),
			self::ERROR_ALREADY_LOCKED
		);
		return null;
	}

	$lock = ObjectLock::add(array_merge($data, array(
		'TOKEN' => $token,
		'OBJECT_ID' => $this->getRealObjectId(),
		'CREATED_BY' => $lockedBy,
	)), $this->errorCollection);

	if($lock)
	{
		$this->update(array('SYNC_UPDATE_TIME' => new DateTime()));
		Driver::getInstance()->sendChangeStatusToSubscribers($this, 'quick');
	}

	return $lock;
}