Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
tgz_extractor_handler Interface Reference

Interface for callback from tgz_extractor\extract. More...

Inheritance diagram for tgz_extractor_handler:
tgz_packer_extract_to_pathname tgz_packer_extract_to_storage

Public Member Functions

 tgz_directory ($archivepath, $mtime)
 Called when a directory entry is found in the archive.
 
 tgz_end_file ($archivepath, $realpath)
 Called when the system has finished extracting a file.
 
 tgz_start_file ($archivepath)
 Called when the system begins to extract a file.
 

Detailed Description

Interface for callback from tgz_extractor\extract.

The file functions will be called (in pairs tgz_start_file, tgz_end_file) for each file in the archive. (There is only one exception, the special .ARCHIVE_INDEX file which is not reported to the handler.)

The directory function is called whenever the archive contains a directory entry.

Member Function Documentation

◆ tgz_directory()

tgz_extractor_handler::tgz_directory ( $archivepath,
$mtime )

Called when a directory entry is found in the archive.

The handler can create a corresponding directory if required.

Parameters
string$archivepathPath and name of directory within archive
int$mtimeModified time of directory
Return values
boolTrue if directory was created, false if skipped

Implemented in tgz_packer_extract_to_pathname, and tgz_packer_extract_to_storage.

◆ tgz_end_file()

tgz_extractor_handler::tgz_end_file ( $archivepath,
$realpath )

Called when the system has finished extracting a file.

The handler can now process the extracted file if required.

Parameters
string$archivepathPath and name of file within archive
string$realpathPath in filesystem (from tgz_start_file return)
Return values
boolTrue to continue processing, false to abort archive extract

Implemented in tgz_packer_extract_to_pathname, and tgz_packer_extract_to_storage.

◆ tgz_start_file()

tgz_extractor_handler::tgz_start_file ( $archivepath)

Called when the system begins to extract a file.

At this point, the handler must decide where on disk the extracted file should be located. This can be a temporary location or final target, as preferred.

The handler can request for files to be skipped, in which case no data will be written and tgz_end_file will not be called.

Parameters
string$archivepathPath and name of file within archive
Return values
stringLocation for output file in filesystem, or null to skip file

Implemented in tgz_packer_extract_to_pathname, and tgz_packer_extract_to_storage.


The documentation for this interface was generated from the following file: