MCPcopy Create free account
hub / github.com/error311/FileRise / loadSnapshot

Method loadSnapshot

src/FileRise/Domain/DiskUsageModel.php:552–570  ·  view source on GitHub ↗

* Load the snapshot from disk, or return null if missing or invalid. */

(string $sourceId = '')

Source from the content-addressed store, hash-verified

550 * Load the snapshot from disk, or return null if missing or invalid.
551 */
552 public static function loadSnapshot(string $sourceId = ''): ?array
553 {
554 $path = self::snapshotPath($sourceId);
555 if (!is_file($path)) {
556 return null;
557 }
558 $raw = @file_get_contents($path);
559 if ($raw === false || $raw === '') {
560 return null;
561 }
562 $data = json_decode($raw, true);
563 if (!is_array($data)) {
564 return null;
565 }
566 if (!isset($data['version']) || (int)$data['version'] !== 1) {
567 return null;
568 }
569 return $data;
570 }
571
572 /**
573 * Compute a lightweight summary for the Admin panel.

Callers 3

getSummaryMethod · 0.95
getChildrenMethod · 0.95
getTopFilesMethod · 0.95

Calls 1

snapshotPathMethod · 0.95

Tested by

no test coverage detected