# disk-usage-insights/1.4/src/Domain/Collect/DetermineLastModifiedDateJob.php

Disk Usage Insights, version 1.4. 44 lines.

- Page: https://pluginprobe.com/plugins/disk-usage-insights/1.4/code/src/Domain/Collect/DetermineLastModifiedDateJob.php
- Raw: https://pluginprobe.com/plugins/disk-usage-insights/1.4/raw/src/Domain/Collect/DetermineLastModifiedDateJob.php
- Modified: 2024-12-19T11:33:52+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/disk-usage-insights/1.4/code/src/Domain/Collect/DetermineLastModifiedDateJob.php#L10-L20`.

```php
<?php

namespace Mgleis\DiskUsageInsights\Domain\Collect;

use Mgleis\DiskUsageInsights\Domain\FileEntry;
use Mgleis\DiskUsageInsights\Domain\Jobs\BaseJob;
use Mgleis\DiskUsageInsights\Domain\Jobs\PhaseCoordinatorJob;

class DetermineLastModifiedDateJob extends BaseJob {

    private int $skip;
    private int $count;
    private int $totalCount;

    public function __construct(int $skip, int $count, int $totalCount) {
        $this->skip = $skip;
        $this->count = $count;
        $this->totalCount = $totalCount;
    }

    public function work() {
        $this->log(self::class);
        $fileEntries = $this->fileEntryRepository->get($this->skip, $this->count);

        $root = $this->snapshotRepository->load()->root;
        foreach ($fileEntries as $fileEntry) {

            $absoluteFilename = $this->fileEntryRepository->calcFullPath($fileEntry, $root);
            $this->log($absoluteFilename);

            $fileEntry->last_modified_date = filemtime($absoluteFilename);
            $this->fileEntryRepository->createOrUpdate($fileEntry);
        }
    }

    public function toArray() {
        return ['type' => self::class, 'args' => [$this->skip, $this->count, $this->totalCount]];
    }

    public function toDescription(): string {
        return sprintf('Determining last modified dates... %s%%', round(100 * $this->skip / $this->totalCount));
    }
}

```
