• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/xmlwriter.php
  • Класс: BitrixMainXmlWriter
  • Вызов: XmlWriter::openFile
public function openFile()
{
	if ($this->file == '')
	{
		$this->addError('File not accessible.', 'XML_FILE_NOT_ACCESSIBLE');
	}
	else
	{
		CheckDirPath($this->file);
		$newFile = !file_exists($this->file);
		if (file_exists($this->file) && !is_writable($this->file))
		{
			chmod($this->file, BX_FILE_PERMISSIONS);
		}
		if (($this->f = fopen($this->file, 'ab')))
		{
			chmod($this->file, BX_FILE_PERMISSIONS);
			if ($newFile)
			{
				fwrite($this->f, 'charset .'"?>' . PHP_EOL);
			}
		}
		else
		{
			$this->addError('File not accessible.', 'XML_FILE_NOT_ACCESSIBLE');
		}
	}
}