Returns the hashes of orphaned icon files, which are no longer used by any icon.
@return array|string[]
493038
protected function findOrphanedHashes(): array
    {
        $queryBuilder = $this->entityManager->createQueryBuilder();
        $queryBuilder->select('if.hash AS hash')
                     ->from(IconFile::class, 'if')
                     ->leftJoin('if.icons', 'i')
                     ->andWhere('i.id IS NULL');

        $result = [];
        foreach ($queryBuilder->getQuery()->getResult() as $data) {
            $result[] = $data['hash'];
        }
        return $result;
    }
778648
def icons(self, strip_ext=False):
        ''''''
        result =  [f for f in self._stripped_files if self._icons_pattern.match(f)]
        if strip_ext:
            result = [strip_suffix(f, '\.({ext})'.format(ext=self._icons_ext), regex=True) for f in result]

        return result
1260420
public function getRuntimeAliases()
    {
        $paths = [];
        foreach ($this->getRuntime() as $key => $value) {
            if (in_array($key, ['hook', 'libraries', 'stylesheets', 'mediaFiles', 'icon', 'src'])) {
                $paths[$key] = preg_replace('/^(.\/)(.*)/', $this->getTypeIdentifier() . "/$2", $this->getRuntimeKey($key));
            }
        }
        return $paths;
    }
988100
public function getAppliedFiles()
    {
        $appliedFinder = $this->getFinder();

        $files = $appliedFinder->files()
            ->in($this->appliedFilesDir)
            ->name(self::PATTERN)
            ->sort($this->sort())
        ;

        return $files;
    }
115374
public function getAllImages()
    {
        $images = new ArrayList();
        if ($this->hasHeroImage()) {
            $images->push($this->HeroImage());
        }
        if ($this->hasGalleryImages()) {
            $images->merge($this->ImageGallery());
        }
        $images->removeDuplicates('HailID');

        return $images;
    }
500006
public function getEntityHashes()
    {
        return array_map(function ($entity) {
            $class = get_class($entity);

            $mapper = Manager::getMapper($class);

            $keyName = $mapper->getEntityMap()->getKeyName();

            return $class.'.'.$entity->getEntityAttribute($keyName);
        },
        $this->items);
    }
1055714
public function getDiffReplacements()
    {
        $data = array();
        foreach ($this->getSafeAttributes() as $attribute) {
            if ($attribute->isReplaced()) {
                $data[$attribute->getName()] = $attribute->getValues();
            }
        }
        foreach ($this->tracker->getReplacements() as $name) {
            $data[$name] = $this->get($name)->getValues();
        }
        return $data;
    }
163573
public function handleExpiration() : array
    {
        $deleted   = [];
        $cacheKeys = $this->cache->keys();

        foreach ($cacheKeys as $key) {
            $fileMeta = $this->cache->get($key, true);

            if ( ! $this->isExpired($fileMeta)) {
                continue;
            }

            if ( ! $this->cache->delete($key)) {
                continue;
            }

            if (is_writable($fileMeta['file_path'])) {
                unlink($fileMeta['file_path']);
            }

            $deleted[] = $fileMeta;
        }

        return $deleted;
    }
109173
private function getArchiveFiles(): array {

        $list = [];

        for ( $i = 0; $i < $this->getArchive()->numFiles; $i++ ) {

            $file = $this->getArchive()->statIndex($i);
            if ( $file === false ) {
                continue;
            }

            $name = str_replace('\\', '/', $file['name']);
            if (
                (
                    $name[0] == "." &&
                    in_array($this->getSkipMode(), ["HIDDEN", "ALL"])
                ) ||
                (
                    $name[0] == "." &&
                    @$name[1] == "_" &&
                    in_array($this->getSkipMode(), ["COMODOJO", "ALL"])
                )
            ) {
                continue;
            }

            $list[] = $name;

        }

        return $list;

    }
579194
protected function getBrokenImageHash()
    {
        if ($this->brokenImageHash) {
            return $this->brokenImageHash;
        }

        $fullPath = $this->getBrokenImagePath();

        return $this->brokenImageHash = hash_file('crc32', $fullPath);
    }
1084098
private function getImageFiles()
    {
        if ($this->imageFiles === null) {
            // Get a list of images.
            $this->imageFiles = $this->filesystem
                ->find()
                ->in('files://')
                ->name('/\.jpe?g$/')
                ->name('*.png')
                ->toArray()
            ;
        }

        return $this->imageFiles;
    }
539684
public function getList()
    {
        $result = [];
        foreach (config('crude_special_files.files') as $key)
            $result[$key] = [
                'key' => $key,
                'label' => $this->getLabel($key),
                'data' => $this->getFileData($key)
            ];

        return $result;
    }
657906
public function keys() {
    $root = $this->directory;
    if (file_exists($root) && is_readable($root)) {
      return array_diff(scandir($root), array('..', '.'));
    }
    return [];
  }
381790
public function getChangesForRemovedEntities()
    {
        $removed = [];
        foreach ($this->changes as $change) {
            if ($change instanceof RemovedEntity) {
                $removed[] = $change;
            }
        }

        return $removed;
    }
1210169
private function getFilesContainingOldKey()
    {
        $affectedFiles = [];

        foreach ($this->manager->getAllViewFilesWithTranslations() as $file => $keys) {
            foreach ($keys as $key) {
                if ($key == $this->argument('oldKey')) {
                    $affectedFiles[$file][] = $key;
                }
            }
        }

        return $affectedFiles;
    }
841463
protected function deleteResamplings() {
        $children = ContentServiceAsset::get()->filter('SourceID', $this->ID);

        $numDeleted = 0;
        foreach ($children as $child) {
            $child->SourceID = -1;

            // we _DONT_ do a hard delete; if content has this image cached, it should be able to
            // hold it for a while. Instead, mark deleted and allow a cleanup job to collect it later
            $child->Filename = 'deleted';
            $child->write();
            $numDeleted++;
        }

        $this->Resamplings = array();
        return $numDeleted;
    }
591249
public function getReplacements()
    {
        $replacements = array_merge(parent::getReplacements(), ['root_namespace' => $this->getAppNamespace()]);

        if ($this->scaffold) {
            return array_merge($replacements, $this->scaffolder->toArray());
        }

        return $replacements;
    }