• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/composite/engine.php
  • Класс: BitrixMainCompositeEngine
  • Вызов: Engine::ensureFileQuota
static function ensureFileQuota($requiredFreeSpace = 0)
{
	static $tries = 2;
	if (Helper::checkQuota($requiredFreeSpace) || $tries <= 0)
	{
		return;
	}

	$records = PageTable::getList(
		array(
			"select" => array("ID", "CACHE_KEY"),
			"order" => array("LAST_VIEWED" => "ASC", "ID" => "ASC"),
			"limit" => self::getDeletionLimit()
		)
	);

	$ids = array();
	$compositeOptions = Helper::getOptions();
	$deletedSize = 0.0;
	while ($record = $records->fetch())
	{
		$ids[] = $record["ID"];
		$fileStorage = new DataFileStorage($record["CACHE_KEY"], array(), $compositeOptions);
		$deletedSize += doubleval($fileStorage->delete());
	}

	PageTable::deleteBatch(array("ID" => $ids));

	Helper::updateCacheFileSize(-$deletedSize);

	Logger::log(array(
		"TYPE" => Logger::TYPE_CACHE_RESET,
		"MESSAGE" =>
			"Pages: ".count($ids)."n".
			"Size: ".CFile::formatSize($deletedSize)
	));

	if (!Helper::checkQuota($requiredFreeSpace))
	{
		$tries--;
		self::ensureFileQuota($requiredFreeSpace);
	}
}