Archive
From Utopia MVC
Archiviation wrapper class for the various php libraries that handle archives providing a streamlined syntax to handle them regardless of the format.
Contents |
Methods
addFromDir
Loads the file in the specified path into the archive.
[toc]Description
public addFromDir (string $sourcePath [,string $localPath = '/' [,boolean $recursive = TRUE]]])
Flexible function that allows both recursive and non recursive loading of files into the archive, can also specify the target path inside the archive.
This will add a referral to the chosen directory, it will NOT however retrieve the list of files.
Parameters
- sourcePath
- the directory that will provide the files to import inside the archive.
- localPath
- the directory inside the zip file that will contain the imported files, if said directory does not exists, it will be created.
- recursive
- determines if the function should traverse the subdirectories of sourcePath.
saveZip
Creates and saves a .zip version of the archive object.
[toc]Description
public bool saveZip (string $path[, bool $ignoreDuplicateNameErrorInTheArchive = false])
Uses the ZipArchive php class.
Parameters
- path
- the path of the resulting zip file.
- ignoreDuplicateNameErrorInTheArchive
- if, while creating the physical archive, multiple files in the list of files to import have the same destination path inside of the Archive, an error will be thrown, as long as this parameter is set to false.
- TODO - Still unimplemented
Return Values
Returns true if everything went fine.