Joomla CMS
4.2.2
Documentation des API du CMS Joomla en version 4.2.2
|
Fonctions membres publiques | |
__construct () | |
__wakeup () | |
enforceMinimumExecutionTime () | |
setFilename (string $value) | |
setAddPath (string $addPath) | |
setSkipFiles (array $skipFiles) | |
setIgnoreDirectories (array $ignoreDirectories) | |
initialize () | |
step () | |
getError () | |
Fonctions membres publiques statiques | |
static | getInstance () |
static | getSerialised () |
static | unserialiseInstance (string $serialised) |
Champs de données | |
$totalSize = 0 | |
$skipFiles = [] | |
$compressedTotal = 0 | |
$uncompressedTotal = 0 | |
$filesProcessed = 0 | |
Fonctions membres privées | |
getTimeLeft () | |
getRunningTime () | |
processLastExtractedFile () | |
setLastExtractedFilename (?string $lastExtractedFilename) | |
setLastExtractedFileTimestamp (int $lastExtractedFileTimestamp) | |
shutdown () | |
binStringLength (?string $string) | |
setError (string $error) | |
fread ($fp, ?int $length=null) | |
readArchiveHeader () | |
readFileHeader () | |
createDirectory () | |
processFileData () | |
openArchiveFile () | |
isEOF () | |
setCorrectPermissions (string $path) | |
isIgnoredDirectory (string $shortFilename) | |
processTypeDir () | |
processTypeLink () | |
processTypeFileUncompressed () | |
processTypeFileCompressed () | |
setupMaxExecTime () | |
getPhpMaxExecTime () | |
debugMsg (string $message, int $priority=self::LOG_INFO) | |
initializeLog (string $logPath) | |
Attributs privés | |
const | CHUNK_SIZE = 524288 |
const | MAX_EXEC_TIME = 4 |
const | RUNTIME_BIAS = 90 |
const | MIN_EXEC_TIME = 3 |
const | AK_STATE_INITIALIZE = -1 |
const | AK_STATE_NOFILE = 0 |
const | AK_STATE_HEADER = 1 |
const | AK_STATE_DATA = 2 |
const | AK_STATE_DATAREAD = 3 |
const | AK_STATE_POSTPROC = 4 |
const | AK_STATE_DONE = 5 |
const | AK_STATE_FINISHED = 999 |
const | LOG_DEBUG = 1 |
const | LOG_INFO = 10 |
const | LOG_WARNING = 50 |
const | LOG_ERROR = 90 |
$maxExecTime = null | |
$startTime | |
$lastErrorMessage = null | |
$filename = null | |
$archiveFileIsBeingRead = false | |
$currentOffset = 0 | |
$addPath = '' | |
$fp = null | |
$runState = self::AK_STATE_INITIALIZE | |
$fileHeader = null | |
$dataReadLength = 0 | |
$ignoreDirectories = [] | |
$expectDataDescriptor = false | |
$lastExtractedFileTimestamp = 0 | |
$lastExtractedFilename = null | |
Attributs privés statiques | |
static | $instance = null |
static | $logFP = null |
static | $logFilePath = null |
ZIP archive extraction class
This is a derivative work of Akeeba Restore which is Copyright (c)2008-2021 Nicholas K. Dionysopoulos and Akeeba Ltd, distributed under the terms of GNU General Public License version 3 or later.
The author of the original work has decided to relicense the derivative work under the terms of the GNU General Public License version 2 or later and share the copyright of the derivative work with Open Source Matters, Inc (OSM), granting OSM non-exclusive rights to this work per the terms of the Joomla Contributor Agreement (JCA) the author signed back in 2011 and which is still in effect. This is affirmed by the cryptographically signed commits in the Git repository containing this file, the copyright messages and this notice here.
__construct | ( | ) |
__wakeup | ( | ) |
Wakeup function, called whenever the class is deserialized.
This method does the following:
|
private |
Unicode-safe binary data length
string | null | $string | The binary data to get the length for |
Référencé par processTypeFileCompressed(), processTypeFileUncompressed(), et processTypeLink().
|
private |
Creates the directory this file points to
Références isIgnoredDirectory(), et setError().
Référencé par readFileHeader().
|
private |
Write a message to the debug error log
string | $message | The message to log |
int | $priority | The message's log priority |
Références $message.
Référencé par fread(), initialize(), openArchiveFile(), processFileData(), processLastExtractedFile(), processTypeFileCompressed(), processTypeFileUncompressed(), processTypeLink(), readArchiveHeader(), readFileHeader(), et step().
enforceMinimumExecutionTime | ( | ) |
Enforce the minimum execution time.
If we need to sleep for more than 1 second we should be using sleep() or time_sleep_until() to prevent high CPU usage, also because some OS might not support sleeping for over 1 second using these functions. In all other cases we will try to use usleep or time_nanosleep instead.
Références getPhpMaxExecTime(), et getRunningTime().
|
private |
Reads data from the archive.
resource | $fp | The file pointer to read data from |
int | null | $length | The volume of data to read, in bytes |
Références $data, $fp, et debugMsg().
Référencé par processTypeFileCompressed(), processTypeFileUncompressed(), processTypeLink(), readArchiveHeader(), et readFileHeader().
getError | ( | ) |
Get the most recent error message
Références $lastErrorMessage.
Référencé par initialize(), et step().
|
static |
Singleton implementation.
|
private |
Get the PHP maximum execution time.
If it's not defined or it's zero (infinite) we use a fake value of 10 seconds.
Référencé par enforceMinimumExecutionTime(), et setupMaxExecTime().
|
private |
Gets the time elapsed since object creation/unserialization, effectively how long Akeeba Engine has been processing data
Références $startTime.
Référencé par enforceMinimumExecutionTime(), et getTimeLeft().
|
static |
Returns a serialised copy of the object.
This is different to calling serialise() directly. This operates on a copy of the object which undergoes a call to shutdown() first so any open files are closed first.
|
private |
Gets the number of seconds left, before we hit the "must break" threshold
Références getRunningTime().
Référencé par processTypeFileUncompressed(), et step().
initialize | ( | ) |
Prepares for the archive extraction
Références debugMsg(), getError(), et readArchiveHeader().
Référencé par step().
|
private |
Initialise the debug log file
string | $logPath | The path where the log file will be written to |
Référencé par setFilename().
|
private |
Returns true if we have reached the end of file
feof() will return false if the file pointer is exactly at the last byte of the file. However, this is a condition we want to treat as a proper EOF for the purpose of extracting a ZIP file. Hence the second part after the logical OR.
Référencé par processTypeFileCompressed(), processTypeFileUncompressed(), processTypeLink(), et readFileHeader().
|
private |
Is this file or directory contained in a directory we've decided to ignore write errors for? This is useful to let the extraction work despite write errors in the log, logs and tmp directories which MIGHT be used by the system on some low quality hosts and Plesk-powered hosts.
string | $shortFilename | The relative path of the file/directory in the package |
Références $check.
Référencé par createDirectory(), processTypeFileCompressed(), et processTypeFileUncompressed().
|
private |
Opens the next part file for reading
Références $message, debugMsg(), et setError().
Référencé par readArchiveHeader().
|
private |
Concrete classes must use this method to process file data. It must set $runState to self::AK_STATE_DATAREAD when it's finished processing the file data.
Références debugMsg(), processTypeDir(), processTypeFileCompressed(), processTypeFileUncompressed(), processTypeLink(), et setError().
Référencé par step().
|
private |
Process the last extracted file or directory
This invalidates OPcache for .php files. Also applies the correct permissions and timestamp.
Références clearFileInOPCache(), et debugMsg().
Référencé par step().
|
private |
Process the file data of a directory entry
Référencé par processFileData().
|
private |
Processes a compressed file
PhpComposerExtensionStubsInspection
PhpComposerExtensionStubsInspection
Références binStringLength(), debugMsg(), fread(), isEOF(), isIgnoredDirectory(), setCorrectPermissions(), et setError().
Référencé par processFileData().
|
private |
Processes an uncompressed (stored) file
Références $data, $dataReadLength, binStringLength(), debugMsg(), fread(), getTimeLeft(), isEOF(), isIgnoredDirectory(), setCorrectPermissions(), et setError().
Référencé par processFileData().
|
private |
Process the file data of a link entry
Références $data, $filename, binStringLength(), clearFileInOPCache(), debugMsg(), fread(), isEOF(), et setError().
Référencé par processFileData().
|
private |
Read the header of the archive, making sure it's a valid ZIP file.
Références debugMsg(), fread(), openArchiveFile(), et setError().
Référencé par initialize().
|
private |
Concrete classes must use this method to read the file header
The last file had bit 3 of the general purpose bit flag set. This means that we have a 12 byte data descriptor we need to skip. To make things worse, there might also be a 4 byte optional data descriptor header (0x08074b50).
Références $dir, $format, $this, createDirectory(), debugMsg(), elseif, fread(), isEOF(), null, setError(), et setLastExtractedFilename().
Référencé par step().
setAddPath | ( | string | $addPath | ) |
Sets the path to prefix all extracted files with. Essentially, where the archive will be extracted to.
string | $addPath | The path where the archive will be extracted. |
Références $addPath.
|
private |
Handles the permissions of the parent directory to a file and the file itself to make it writeable.
string | $path | A path to a file |
Référencé par processTypeFileCompressed(), et processTypeFileUncompressed().
|
private |
Add an error message
string | $error | Error message |
Référencé par createDirectory(), openArchiveFile(), processFileData(), processTypeFileCompressed(), processTypeFileUncompressed(), processTypeLink(), readArchiveHeader(), readFileHeader(), et setFilename().
setFilename | ( | string | $value | ) |
Set the filepath to the ZIP archive which will be extracted.
string | $value | The filepath to the archive. Only LOCAL files are allowed! |
Références $value, initializeLog(), et setError().
setIgnoreDirectories | ( | array | $ignoreDirectories | ) |
Set the directories to skip over when extracting the ZIP archive
array | $ignoreDirectories | The list of directories to ignore. |
Références $ignoreDirectories.
|
private |
Set the last extracted filename
string | null | $lastExtractedFilename | The last extracted filename |
Références $lastExtractedFilename.
Référencé par readFileHeader().
|
private |
Set the last modification UNIX timestamp for the last extracted file
int | $lastExtractedFileTimestamp | The timestamp |
Références $lastExtractedFileTimestamp.
Référencé par step().
setSkipFiles | ( | array | $skipFiles | ) |
Set the list of files to skip when extracting the ZIP file.
array | $skipFiles | A list of files to skip when extracting the ZIP archive |
Références $skipFiles.
|
private |
Set up the maximum execution time
Références getPhpMaxExecTime().
Référencé par __construct().
|
private |
Sleep function, called whenever the class is serialized
step | ( | ) |
Executes a step of the archive extraction
Références debugMsg(), elseif, getError(), getTimeLeft(), initialize(), null, processFileData(), processLastExtractedFile(), readFileHeader(), et setLastExtractedFileTimestamp().
|
static |
Restores a serialised instance into the singleton implementation and returns it.
If the serialised data is corrupt it will return null.
string | $serialised | The serialised data, potentially base64 encoded, to deserialize. |
|
private |
Référencé par setAddPath().
|
private |
$compressedTotal = 0 |
|
private |
|
private |
Référencé par processTypeFileUncompressed().
|
private |
|
private |
|
private |
Référencé par processTypeLink().
$filesProcessed = 0 |
|
private |
Référencé par setIgnoreDirectories().
|
staticprivate |
Référencé par unserialiseInstance().
|
private |
Référencé par getError().
|
private |
Référencé par setLastExtractedFilename().
|
private |
Référencé par setLastExtractedFileTimestamp().
|
staticprivate |
|
staticprivate |
|
private |
|
private |
$skipFiles = [] |
Référencé par setSkipFiles().
|
private |
Référencé par getRunningTime().
$totalSize = 0 |
$uncompressedTotal = 0 |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |