- Модуль: webdav
- Путь к файлу: ~/bitrix/modules/webdav/classes/file.php
- Класс: CWebDavFile
- Вызов: CWebDavFile::LOCK
function LOCK(&$options)
{
$this->IsDir();
if (
$this->arParams["is_dir"]
&& !empty($options["depth"])
)
return "409 Conflict";
$options["timeout"] = time() + 300;
$arProps = $this->_get_props($this->arParams["parent_id"].$this->arParams["base_name"]);
if (isset($options["update"]))
{
$token = $options["update"];
if (
array_key_exists("LOCK", $arProps) &&
array_key_exists($token, $arProps["LOCK"]) &&
(array_key_exists("owner", $arProps["LOCK"][$token]) && $arProps["LOCK"][$token]["owner"] <> '') &&
(array_key_exists("exclusivelock", $arProps["LOCK"][$token]) && $arProps["LOCK"][$token]["exclusivelock"] <> '')
)
{
$arProps["LOCK"][$token]["expires"] = $options["timeout"];
$arProps["LOCK"][$token]["modified"] = time();
$options["owner"] = $GLOBALS['USER']->GetLogin();
$options["scope"] = $arProps["LOCK"][$token]["exclusivelock"] ? "exclusive" : "shared";
$options["type"] = $arProps["LOCK"][$token]["exclusivelock"] ? "write" : "read";
return true;
}
else
{
return false;
}
}
$arProps["LOCK"][$options["locktoken"]] = array(
"created" => time(),
"modified" => time(),
"owner" => $GLOBALS['USER']->GetLogin(),
"token" => $options["locktoken"],
"expires" => $options["timeout"],
"exclusivelock" => ($options["scope"] === "exclusive" ? 1 : 0)
);
$this->_set_props($this->arParams["parent_id"].$this->arParams["base_name"], $arProps);
return "200 OK";
}