Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
Extracts .tar.gz files (POSIX format). More...
Public Member Functions | |
__construct ($archivefile) | |
Constructor. More... | |
extract (tgz_extractor_handler $handler, file_progress $progress=null) | |
Extracts the archive. More... | |
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. More... | |
Protected Member Functions | |
close_current_file ($handler) | |
Closes the current file, calls handler, and sets up data. More... | |
extract_or_list (tgz_extractor_handler $handler=null, file_progress $progress=null) | |
Extracts or lists the archive depending on $this->listmode. More... | |
process_file_block ($block, tgz_extractor_handler $handler=null) | |
Processes one 512-byte block of an existing file. More... | |
process_header ($block, $handler) | |
Process 512-byte header block. More... | |
start_current_file ($archivepath, $filesize, $mtime, tgz_extractor_handler $handler=null) | |
Starts processing a file from archive. More... | |
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 |