FileFetcherUploadZip
extends FileFetcher
in package
Extension file fetcher for upload ZIP file.
Must work for all extension types: plugins, theme, question theme, etc.
Tags
Table of Contents
Properties
- $filterName : string
- Filter to apply to unzipping.
Methods
- abort() : void
- Abort unzip, clear files and session.
- fetch() : void
- Fetch files, meaning grab uploaded ZIP file and unzip it in system tmp folder.
- getConfig() : ExtensionConfig
- Get config from unzipped zip file, but in temp dir. fetch() must be called before this.
- getConfigFromDir() : ExtensionConfig|null
- Look for config.xml in $tempdir Recursively searches the folders if config.xml is not in root folder.
- move() : bool
- Move files from tempdir to final destdir.
- recurseCopy() : bool
- Recursively copy source folder $src to destination $dest.
- setSource() : void
- Set source for this file fetcher.
- setUnzipFilter() : void
- checkFileSizeError() : void
- checkZipBomb() : void
- Check if uploaded zip file is a zip bomb.
- clearTmpdir() : void
- Set user session tempdir to null.
- extractZipFile() : void
- getTempdir() : string
- Get tmp tempdir for extension to unzip in.
Properties
$filterName
Filter to apply to unzipping.
protected
string
$filterName
Methods
abort()
Abort unzip, clear files and session.
public
abort() : void
fetch()
Fetch files, meaning grab uploaded ZIP file and unzip it in system tmp folder.
public
fetch() : void
getConfig()
Get config from unzipped zip file, but in temp dir. fetch() must be called before this.
public
getConfig() : ExtensionConfig
Tags
Return values
ExtensionConfiggetConfigFromDir()
Look for config.xml in $tempdir Recursively searches the folders if config.xml is not in root folder.
public
getConfigFromDir(string $tempdir) : ExtensionConfig|null
Parameters
- $tempdir : string
Return values
ExtensionConfig|nullmove()
Move files from tempdir to final destdir.
public
move(string $destdir) : bool
Parameters
- $destdir : string
Return values
boolrecurseCopy()
Recursively copy source folder $src to destination $dest.
public
recurseCopy(string $src, string $dest) : bool
Parameters
- $src : string
- $dest : string
Tags
Return values
boolsetSource()
Set source for this file fetcher.
public
setSource(string $source) : void
Parameters
- $source : string
setUnzipFilter()
public
setUnzipFilter(string $filterName) : void
Parameters
- $filterName : string
checkFileSizeError()
protected
checkFileSizeError() : void
Tags
checkZipBomb()
Check if uploaded zip file is a zip bomb.
protected
checkZipBomb() : void
clearTmpdir()
Set user session tempdir to null.
protected
clearTmpdir() : void
extractZipFile()
protected
extractZipFile(string $tempdir) : void
Parameters
- $tempdir : string
getTempdir()
Get tmp tempdir for extension to unzip in.
protected
getTempdir() : string