Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
|
Extracts .tar.gz files (POSIX format). More...
Public Member Functions | |
__construct ($archivefile) | |
Constructor. | |
extract (tgz_extractor_handler $handler, file_progress $progress=null) | |
Extracts the archive. | |
list_files () | |
Lists files in the archive, either using the index file (if present), or by basically extracting the whole thing if there isn't an index file. | |
Protected Member Functions | |
close_current_file ($handler) | |
Closes the current file, calls handler, and sets up data. | |
extract_or_list (tgz_extractor_handler $handler=null, file_progress $progress=null) | |
Extracts or lists the archive depending on $this->listmode. | |
process_file_block ($block, tgz_extractor_handler $handler=null) | |
Processes one 512-byte block of an existing file. | |
process_header ($block, $handler) | |
Process 512-byte header block. | |
start_current_file ($archivepath, $filesize, $mtime, tgz_extractor_handler $handler=null) | |
Starts processing a file from archive. | |
Protected Attributes | |
string | $currentarchivepath |
Current file path within archive. | |
string | $currentfile |
Full path to current file. | |
int | $currentfileprocessed |
Number of bytes of current file already written into buffer. | |
int | $currentfilesize |
Size of current file in bytes. | |
resource | $currentfp |
File handle to current file. | |
int | $currentmtime |
Modified time of current file. | |
int | $donefiles |
Number of files processed so far. | |
string | $filebuffer |
Buffer containing file data awaiting write. | |
int | $filebufferlength |
Current length of buffer in bytes. | |
array | $listresults = null |
In list mode, content of the list; outside list mode, null. | |
int | $mode = self::MODE_EXTRACT |
Whether listing or extracting. | |
int | $numfiles |
Number of files (-1 if not known). | |
string | $ospath |
OS path for archive. | |
array | $results |
Results array of all files processed. | |
stored_file | $storedfile |
File object for archive. | |
Extracts .tar.gz files (POSIX format).
tgz_extractor::__construct | ( | $archivefile | ) |
Constructor.
stored_file | string | $archivefile | Moodle file or OS path to archive |
|
protected |
Closes the current file, calls handler, and sets up data.
tgz_extractor_handler | $handler | Will be called for extracted files |
moodle_exception | If there is an error closing it |
tgz_extractor::extract | ( | tgz_extractor_handler | $handler, |
file_progress | $progress = null ) |
Extracts the archive.
tgz_extractor_handler | $handler | Will be called for extracted files |
file_progress | $progress | Optional progress reporting |
array | Array from archive path => true of processed files |
moodle_exception | If there is any error processing the archive |
|
protected |
Extracts or lists the archive depending on $this->listmode.
tgz_extractor_handler | $handler | Optional handler |
file_progress | $progress | Optional progress reporting |
moodle_exception | If there is any error processing the archive |
tgz_extractor::list_files | ( | ) |
Lists files in the archive, either using the index file (if present), or by basically extracting the whole thing if there isn't an index file.
array | Array of file listing results: |
|
protected |
Processes one 512-byte block of an existing file.
string | $block | Data block |
tgz_extractor_handler | $handler | Will be called for extracted files |
|
protected |
Process 512-byte header block.
string | $block | Tar block |
tgz_extractor_handler | $handler | Will be called for extracted files |
|
protected |
Starts processing a file from archive.
string | $archivepath | Path inside archive |
int | $filesize | Size in bytes |
int | $mtime | File-modified time |
tgz_extractor_handler | $handler | Will be called for extracted files |
moodle_exception |