PartKeepr\CoreBundle\Services\SystemService::getUsedDiskSpace PHP Method

getUsedDiskSpace() public method

Does not count temporary files.
public getUsedDiskSpace ( ) : integer
return integer
    public function getUsedDiskSpace()
    {
        if ($this->container->getParameter('partkeepr.filesystem.quota') === false) {
            return $this->getTotalDiskSpace() - $this->getFreeDiskSpace();
        }
        $fileEntities = ['PartKeepr\\FootprintBundle\\Entity\\FootprintAttachment', 'PartKeepr\\FootprintBundle\\Entity\\FootprintImage', 'PartKeepr\\ManufacturerBundle\\Entity\\ManufacturerICLogo', 'PartKeepr\\PartBundle\\Entity\\PartAttachment', 'PartKeepr\\ProjectBundle\\Entity\\ProjectAttachment', 'PartKeepr\\StorageLocationBundle\\Entity\\StorageLocationImage'];
        $size = 0;
        foreach ($fileEntities as $fileEntity) {
            $qb = $this->container->get('doctrine.orm.default_entity_manager')->createQueryBuilder();
            $qb->select('SUM(a.size)')->from($fileEntity, 'a');
            $size += $qb->getQuery()->getSingleScalarResult();
        }
        return $size;
    }