[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_joomlaupdate/ -> extract.php (summary)

(no description)

Copyright: (C) 2021 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
File Size: 1980 lines (61 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

ZIPExtraction:: (43 methods):
  __construct()
  getInstance()
  getSerialised()
  unserialiseInstance()
  __wakeup()
  enforceMinimumExecutionTime()
  setFilename()
  setAddPath()
  setSkipFiles()
  setIgnoreDirectories()
  initialize()
  step()
  getError()
  getTimeLeft()
  getRunningTime()
  processLastExtractedFile()
  setLastExtractedFilename()
  setLastExtractedFileTimestamp()
  shutdown()
  binStringLength()
  setError()
  fread()
  readArchiveHeader()
  readFileHeader()
  createDirectory()
  processFileData()
  openArchiveFile()
  isEOF()
  setCorrectPermissions()
  isIgnoredDirectory()
  processTypeDir()
  processTypeLink()
  processTypeFileUncompressed()
  processTypeFileCompressed()
  setupMaxExecTime()
  getPhpMaxExecTime()
  debugMsg()
  initializeLog()
  clearFileInOPCache()
  timingSafeEquals()
  getConfiguration()
  setLongTimeout()
  setHugeMemoryLimit()


Class: ZIPExtraction  - X-Ref

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()   X-Ref
Public constructor.

Sets up the internal timer.


getInstance()   X-Ref
Singleton implementation.

return: static

getSerialised()   X-Ref
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.

return: string  The serialised data, potentially base64 encoded.

unserialiseInstance(string $serialised)   X-Ref
Restores a serialised instance into the singleton implementation and returns it.

If the serialised data is corrupt it will return null.

param: string  $serialised  The serialised data, potentially base64 encoded, to deserialize.
return: static|null  The instance of the object, NULL if it cannot be deserialised.

__wakeup()   X-Ref
Wakeup function, called whenever the class is deserialized.

This method does the following:
- Restart the timer.
- Reopen the archive file, if one is defined.
- Seek to the correct offset of the file.

return: void

enforceMinimumExecutionTime()   X-Ref
Enforce the minimum execution time.

return: void

setFilename(string $value)   X-Ref
Set the filepath to the ZIP archive which will be extracted.

param: string  $value  The filepath to the archive. Only LOCAL files are allowed!
return: void

setAddPath(string $addPath)   X-Ref
Sets the path to prefix all extracted files with. Essentially, where the archive will be extracted to.

param: string  $addPath  The path where the archive will be extracted.
return: void

setSkipFiles(array $skipFiles)   X-Ref
Set the list of files to skip when extracting the ZIP file.

param: array  $skipFiles  A list of files to skip when extracting the ZIP archive
return: void

setIgnoreDirectories(array $ignoreDirectories)   X-Ref
Set the directories to skip over when extracting the ZIP archive

param: array  $ignoreDirectories  The list of directories to ignore.
return: void

initialize()   X-Ref
Prepares for the archive extraction

return: void

step()   X-Ref
Executes a step of the archive extraction

return: boolean  True if we are done extracting or an error occurred

getError()   X-Ref
Get the most recent error message

return: string|null  The message string, null if there's no error

getTimeLeft()   X-Ref
Gets the number of seconds left, before we hit the "must break" threshold

return: float

getRunningTime()   X-Ref
Gets the time elapsed since object creation/unserialization, effectively how
long Akeeba Engine has been processing data

return: float

processLastExtractedFile()   X-Ref
Process the last extracted file or directory

This invalidates OPcache for .php files. Also applies the correct permissions and timestamp.

return: void

setLastExtractedFilename(?string $lastExtractedFilename)   X-Ref
Set the last extracted filename

param: string|null  $lastExtractedFilename  The last extracted filename
return: void

setLastExtractedFileTimestamp(int $lastExtractedFileTimestamp)   X-Ref
Set the last modification UNIX timestamp for the last extracted file

param: int  $lastExtractedFileTimestamp  The timestamp
return: void

shutdown()   X-Ref
Sleep function, called whenever the class is serialized

return: void

binStringLength(?string $string)   X-Ref
Unicode-safe binary data length

param: string|null  $string  The binary data to get the length for
return: integer

setError(string $error)   X-Ref
Add an error message

param: string  $error  Error message
return: void

fread($fp, ?int $length = null)   X-Ref
Reads data from the archive.

param: resource  $fp      The file pointer to read data from
param: int|null  $length  The volume of data to read, in bytes
return: string  The data read from the file

readArchiveHeader()   X-Ref
Read the header of the archive, making sure it's a valid ZIP file.

return: void

readFileHeader()   X-Ref
Concrete classes must use this method to read the file header

return: boolean True if reading the file was successful, false if an error occurred or we

createDirectory()   X-Ref
Creates the directory this file points to

return: void

processFileData()   X-Ref
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.

return: boolean  True if processing the file data was successful, false if an error occurred

openArchiveFile()   X-Ref
Opens the next part file for reading

return: void

isEOF()   X-Ref
Returns true if we have reached the end of file

return: boolean  True if we have reached End Of File

setCorrectPermissions(string $path)   X-Ref
Handles the permissions of the parent directory to a file and the file itself to make it writeable.

param: string  $path  A path to a file
return: void

isIgnoredDirectory(string $shortFilename)   X-Ref
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.

param: string  $shortFilename  The relative path of the file/directory in the package
return: boolean  True if it belongs in an ignored directory

processTypeDir()   X-Ref
Process the file data of a directory entry

return: boolean

processTypeLink()   X-Ref
Process the file data of a link entry

return: boolean

processTypeFileUncompressed()   X-Ref
Processes an uncompressed (stored) file

return: boolean

processTypeFileCompressed()   X-Ref
Processes a compressed file

return: boolean

setupMaxExecTime()   X-Ref
Set up the maximum execution time

return: void

getPhpMaxExecTime()   X-Ref
Get the PHP maximum execution time.

If it's not defined or it's zero (infinite) we use a fake value of 10 seconds.

return: integer

debugMsg(string $message, int $priority = self::LOG_INFO)   X-Ref
Write a message to the debug error log

param: string  $message   The message to log
param: int     $priority  The message's log priority
return: void

initializeLog(string $logPath)   X-Ref
Initialise the debug log file

param: string  $logPath  The path where the log file will be written to
return: void

clearFileInOPCache(string $file)   X-Ref
Invalidate a file in OPcache.

Only applies if the file has a .php extension.

param: string  $file  The filepath to clear from OPcache
return: boolean

timingSafeEquals($known, $user)   X-Ref
A timing safe equals comparison.

Uses the built-in hash_equals() method if it exists. It SHOULD exist, as it's available since PHP 5.6 whereas even
Joomla 4.0 requires PHP 7.2 or later. If for any reason the built-in function is not available (for example, a host
has disabled it because they do not understand the first thing about security) we will fall back to a safe, userland
implementation.

param: string  $known  The known value to check against
param: string  $user   The user submitted value to check
return: boolean  True if the two strings are identical.

getConfiguration()   X-Ref
Gets the configuration parameters from the update.php file and validates the password sent with
the request.

return: array|null  The configuration parameters to use. NULL if this is an invalid request.

setLongTimeout()   X-Ref
Sets the PHP timeout to 3600 seconds

return: void

setHugeMemoryLimit()   X-Ref
Sets the memory limit to 1GiB

return: void



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer