- Модуль: webdav
- Путь к файлу: ~/bitrix/modules/webdav/classes/editdocgoogle.php
- Класс: CWebDavEditDocGoogle
- Вызов: CWebDavEditDocGoogle::removeFile
public function removeFile(array $fileData)
{
$accessToken = $this->getAccessToken();
$id = $fileData['id'];
$http = new CHTTP();
$http->http_timeout = 10;
$arUrl = $http->ParseURL('https://www.googleapis.com/drive/v2/files/' . $id);
$http->SetAdditionalHeaders(array(
"Authorization" => "Bearer {$accessToken}",
));
$postFields = '';
$postContentType = '';
if(!$http->Query('DELETE', $arUrl['host'], $arUrl['port'], $arUrl['path_query'], $postFields, $arUrl['proto'], $postContentType))
{
return false;
}
// access token expired, let's get a new one and try again
if ($http->status == "401")
{
//todo: invalid credential response
return false;
}
// error checking
if ($http->status != "200")
{
return false;
}
return true;
}