Backend\Models\ImportModel\DecodesZip
Overview
DecodesZip format for import
Protected Properties
protected string|null $importFilesPath
importFilesPath is the directory path containing extracted files from a ZIP import
protected string|null $importDataFilePath
importDataFilePath caches the data file path from a previously extracted ZIP to avoid re-extraction
protected string|null $pathPrefix
pathPrefix for resolving relative file paths in seed context
Public Methods
public getImportFilesPath()
public getImportFilesPath(): void
getImportFilesPath returns the directory path containing extracted files from a ZIP import, or null if not a ZIP import
public setSourcePrefix()
public setSourcePrefix($pathPrefix): void
setSourcePrefix prefixes file paths with the provided path, used in theme seed context
Protected Methods
protected attachImportFile()
protected attachImportFile($model, $attr, $value, $sessionKey): void
attachImportFile attaches a referenced file after checking its type against the field and cleaning vector content.
protected decodeFileRelation()
protected decodeFileRelation($model, $attr, $value, $sessionKey): void
decodeFileRelation creates file attachments from path references
protected extractImportZip()
protected extractImportZip($zipPath): void
extractImportZip extracts a ZIP archive and returns the path to the data file inside. Also sets importFilesPath for file attachment resolution.
protected getImportFileTypes()
protected getImportFileTypes($model, $attr): array|null
getImportFileTypes returns the lowercase extensions a file field accepts, or null when any type is accepted.
protected resolveImportFilePath()
protected resolveImportFilePath($value): void
resolveImportFilePath resolves a file reference to a local filesystem path. Supports: ZIP-relative paths (files/...), media library paths, and source prefix paths (theme seed context).
protected safeResolvePath()
protected safeResolvePath($base, $value): string|null
safeResolvePath returns the resolved real path of $value joined to $base only if the result is contained within $base. Returns null otherwise. Prevents path traversal via .. segments or symlink escapes.