Utility class - handles all zipping and unzipping operations.  
 More...
|  | 
|  | archive_to_pathname (array $files, $archivefile, $ignoreinvalidfiles=true, file_progress $progress=null) | 
|  | Zip files and store the result in os file. 
 | 
|  | 
|  | archive_to_storage (array $files, $contextid, $component, $filearea, $itemid, $filepath, $filename, $userid=NULL, $ignoreinvalidfiles=true, file_progress $progress=null) | 
|  | Zip files and store the result in file storage. 
 | 
|  | 
|  | extract_to_pathname ($archivefile, $pathname, array $onlyfiles=null, file_progress $progress=null, $returnbool=false) | 
|  | Unzip file to given file path (real OS filesystem), existing files are overwritten. 
 | 
|  | 
|  | extract_to_storage ($archivefile, $contextid, $component, $filearea, $itemid, $pathbase, $userid=NULL, file_progress $progress=null) | 
|  | Unzip file to given file path (real OS filesystem), existing files are overwritten. 
 | 
|  | 
|  | list_files ($archivefile) | 
|  | Returns array of info about all files in archive. 
 | 
|  | 
Utility class - handles all zipping and unzipping operations. 
- Copyright
- 2008 Petr Skoda (http://skodak.org) 
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
◆ archive_to_pathname()
      
        
          | zip_packer::archive_to_pathname | ( | array | $files, | 
        
          |  |  |  | $archivefile, | 
        
          |  |  |  | $ignoreinvalidfiles = true, | 
        
          |  |  | file_progress | $progress = null ) | 
      
 
Zip files and store the result in os file. 
- Parameters
- 
  
    | array | $files | array with zip paths as keys (archivepath=>ospathname or archivepath=>stored_file or archivepath=>array('content_as_string')) |  | string | $archivefile | path to target zip file |  | bool | $ignoreinvalidfiles | true means ignore missing or invalid files, false means abort on any error |  | file_progress | $progress | Progress indicator callback or null if not required |  
 
- Return values
- 
  
    | bool | true if file created, false if not |  
 
Reimplemented from file_packer.
 
 
◆ archive_to_storage()
      
        
          | zip_packer::archive_to_storage | ( | array | $files, | 
        
          |  |  |  | $contextid, | 
        
          |  |  |  | $component, | 
        
          |  |  |  | $filearea, | 
        
          |  |  |  | $itemid, | 
        
          |  |  |  | $filepath, | 
        
          |  |  |  | $filename, | 
        
          |  |  |  | $userid = NULL, | 
        
          |  |  |  | $ignoreinvalidfiles = true, | 
        
          |  |  | file_progress | $progress = null ) | 
      
 
Zip files and store the result in file storage. 
- Parameters
- 
  
    | array | $files | array with full zip paths (including directory information) as keys (archivepath=>ospathname or archivepath/subdir=>stored_file or archivepath=>array('content_as_string')) |  | int | $contextid | context ID |  | string | $component | component |  | string | $filearea | file area |  | int | $itemid | item ID |  | string | $filepath | file path |  | string | $filename | file name |  | int | $userid | user ID |  | bool | $ignoreinvalidfiles | true means ignore missing or invalid files, false means abort on any error |  | file_progress | $progress | Progress indicator callback or null if not required |  
 
- Return values
- 
  
    | stored_file|bool | false if error stored_file instance if ok |  
 
Reimplemented from file_packer.
 
 
◆ extract_to_pathname()
      
        
          | zip_packer::extract_to_pathname | ( |  | $archivefile, | 
        
          |  |  |  | $pathname, | 
        
          |  |  | array | $onlyfiles = null, | 
        
          |  |  | file_progress | $progress = null, | 
        
          |  |  |  | $returnbool = false ) | 
      
 
Unzip file to given file path (real OS filesystem), existing files are overwritten. 
- Todo
- MDL-31048 localise messages 
- Parameters
- 
  
    | string | stored_file | $archivefile | full pathname of zip file or stored_file instance |  | string | $pathname | target directory |  | array | $onlyfiles | only extract files present in the array. The path to files MUST NOT start with a /. Example: array('myfile.txt', 'directory/anotherfile.txt') |  | file_progress | $progress | Progress indicator callback or null if not required |  | bool | $returnbool | Whether to return a basic true/false indicating error state, or full per-file error details. |  
 
- Return values
- 
  
    | bool|array | list of processed files; false if error |  
 
Reimplemented from file_packer.
 
 
◆ extract_to_storage()
      
        
          | zip_packer::extract_to_storage | ( |  | $archivefile, | 
        
          |  |  |  | $contextid, | 
        
          |  |  |  | $component, | 
        
          |  |  |  | $filearea, | 
        
          |  |  |  | $itemid, | 
        
          |  |  |  | $pathbase, | 
        
          |  |  |  | $userid = NULL, | 
        
          |  |  | file_progress | $progress = null ) | 
      
 
Unzip file to given file path (real OS filesystem), existing files are overwritten. 
- Todo
- MDL-31048 localise messages 
- Parameters
- 
  
    | string | stored_file | $archivefile | full pathname of zip file or stored_file instance |  | int | $contextid | context ID |  | string | $component | component |  | string | $filearea | file area |  | int | $itemid | item ID |  | string | $pathbase | file path |  | int | $userid | user ID |  | file_progress | $progress | Progress indicator callback or null if not required |  
 
- Return values
- 
  
    | array|bool | list of processed files; false if error |  
 
Reimplemented from file_packer.
 
 
◆ list_files()
      
        
          | zip_packer::list_files | ( |  | $archivefile | ) |  | 
      
 
Returns array of info about all files in archive. 
- Parameters
- 
  
  
- Return values
- 
  
  
Reimplemented from file_packer.
 
 
The documentation for this class was generated from the following file: