• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/controller/export.php
  • Класс: BitrixMainControllerExport
  • Вызов: Export::purgeAction
public function purgeAction()
{
	$this->instanceBucket();

	if ($this->bucket instanceof CCloudStorageBucket)
	{
		$dirFiles = $this->bucket->ListFiles($this->generateUploadDir(), true);

		$now = new DateTime('now');
		foreach ($dirFiles['file'] as $fileName)
		{
			if (preg_match('/^([^_]+)_([0-9]{8})_([^_]+)_.+$/i', $fileName, $parts))
			{
				//$type = $parts[1];
				//$hash = $parts[3];
				$date = DateTime::createFromFormat('Ymd', $parts[2]);
				$interval = $now->diff($date);
				if ($interval->d > self::EXPIRE_DAYS)
				{
					$this->bucket->DeleteFile($this->generateUploadDir(). $fileName);
				}
			}
		}
	}

	return $this->finishAction();
}