• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/volume/module/im.php
  • Класс: BitrixDiskVolumeModuleIm
  • Вызов: Im::getMeasurementFolderResult
public function getMeasurementFolderResult($collectedData = [])
{
	BitrixMainLoader::includeModule(self::getModuleId());

	$chatList = [];

	$totalSize = 0;
	$storageList = $this->getStorageList();
	if (count($storageList) > 0)
	{
		foreach ($storageList as $storage)
		{
			$folders = $this->getFolderList($storage);
			$folderIds = [];
			if (count($folders) > 0)
			{
				foreach ($folders as $folder)
				{
					$folderIds[] = $folder->getId();
				}
			}

			if (count($folderIds) > 0)
			{
				$folder = new VolumeFolderTree;
				$folder
					->setOwner($this->getOwner())
					->addFilter('=STORAGE_ID', $storage->getId())
					->addFilter('@FOLDER_ID', $folderIds)
					->loadTotals();

				if ($folder->getTotalCount() > 0)
				{
					$result = $folder->getMeasurementResult();

					foreach ($result as $row)
					{
						$chatList[] = $row;
						$totalSize += $row['FILE_SIZE'];
					}
				}
			}
		}
	}
	if ($totalSize > 0)
	{
		foreach ($chatList as $id => $row)
		{
			$percent = $row['FILE_SIZE'] * 100 / $totalSize;
			$chatList[$id]['PERCENT'] = round($percent, 1);
		}
	}

	return $chatList;
}