• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/document/myofficehandler.php
  • Класс: BitrixDiskDocumentMyOfficeHandler
  • Вызов: MyOfficeHandler::deleteFile
public function deleteFile(FileData $fileData)
{
	if(!$this->checkRequiredInputParams($fileData->toArray(), array(
		'id',
	)))
	{
		return null;
	}

	$http = new HttpClient(array(
		'redirect' => false,
		'socketTimeout' => 10,
		'streamTimeout' => 30,
		'version' => HttpClient::HTTP_1_1,
	));

	$http->setHeader('X-co-auth-token', $this->getAccessToken());

	if($http->post($this->getApiUrlRoot() . "/files/{$fileData->getId()}/trash") === false)
	{
		$errorString = implode('; ', array_keys($http->getError()));
		$this->errorCollection->add(array(
			new Error($errorString, self::ERROR_HTTP_DELETE_FILE)
		));
		return false;
	}

	if(!$this->checkHttpResponse($http))
	{
		return false;
	}

	return true;
}