, in a folder named after the job's random id. */ public static function staging_dir(string $job_id): string { return Fs::ensure_private_dir(self::work_dir() . '/' . self::name() . '-staging') . '/' . $job_id; } /** A migration's own working files (file list, needed list): //.relay. */ public static function job_dir(string $job_id): string { $dir = self::staging_dir($job_id) . '/.relay'; Fs::ensure_dir($dir); return $dir; } /** File restore points once packed (Files\PointArchive): wp-content/uploads/siterelay/restore-points (private). */ public static function point_archives_dir(): string { return Fs::ensure_private_dir(self::export_dir() . '/restore-points'); } /** Items a job replaces, set aside until the job has finished and they are packed: uploads/siterelay/siterelay-backups/(.journal). */ public static function points_dir(): string { return Fs::ensure_private_dir(self::work_dir() . '/' . self::name() . '-backups'); } /** The journal of a job's file moves (its file restore point). */ public static function journal(string $job_id): string { return self::points_dir() . '/' . $job_id . '.journal'; } /** Where a job's replaced files are set aside: /. */ public static function aside(string $job_id): string { return self::points_dir() . '/' . $job_id; } public static function random_name(string $ext): string { return bin2hex(random_bytes(16)) . '.' . $ext; } }