AutoUpdaterDownloadHelper
extends AbstractAutoUpdaterHelper
in package
Class AutoUpdaterDownloadHelper
Table of Contents
- $ajaxTimeout : int
- $curl : AutoUpdaterCurlClient
- $downloadingFilesDone : bool
- $ftpManager : AutoUpdaterFtpManager
- $lastDownloadedIndex : int
- $logControl : LogControl
- $progress : float
- $settings : AutoUpdaterSettings
- __construct() : mixed
- AutoUpdaterFilesystemHelper constructor.
- deleteFile() : bool
- Copies a file.
- downloadingFilesDone() : mixed
- downloadUpdate() : mixed
- Downloads a zip archive of a given update and extracts it. If the zip extension is not available on the web server, the downloadUpdateFilesSeparately method will be used as a fallback.
- getLastDownloadedIndex() : mixed
- getProgress() : mixed
- registerFtpManager() : mixed
- Registers the auto updater ftp manager.
- changeFileBasePath() : string
- Replaces the base directory path of a given file path with a new base directory path.
- checkUnpackedFiles() : mixed
- Checks the unpacked files.
- copyFile() : bool
- Copies a file.
- createDebugLog() : mixed
- Creates a new debug log.
- createDirectory() : bool
- Return true on success, otherwise false.
- deleteDirectory() : bool
- Deletes a directory. Return true on success and false otherwise.
- downloadExternalFile() : mixed
- Downloads an external file with curl.
- downloadUpdateFilesSeparately() : mixed
- Downloads all update files of a given update into a given update files directory.
- extractZip() : mixed
- Extracts a given zip file to a given directory
- getDirectoryFiles() : array<string|int, mixed>
- Returns an array with all files inside a given directory and his subdirectories.
- setCorrectChmodAndOwner() : bool
- Sets the file permissions and ownership correctly.
Properties
$ajaxTimeout
protected
int
$ajaxTimeout
$curl
protected
AutoUpdaterCurlClient
$curl
$downloadingFilesDone
protected
bool
$downloadingFilesDone
$ftpManager
protected
AutoUpdaterFtpManager
$ftpManager
$lastDownloadedIndex
protected
int
$lastDownloadedIndex
$logControl
protected
LogControl
$logControl
$progress
protected
float
$progress
$settings
protected
AutoUpdaterSettings
$settings
Methods
__construct()
AutoUpdaterFilesystemHelper constructor.
public
__construct(AutoUpdaterSettings $settings, AutoUpdaterCurlClient $curl, LogControl $logControl) : mixed
Parameters
- $settings : AutoUpdaterSettings
- $curl : AutoUpdaterCurlClient
- $logControl : LogControl
Return values
mixed —deleteFile()
Copies a file.
public
deleteFile(string $file) : bool
Parameters
- $file : string
Return values
bool —downloadingFilesDone()
public
downloadingFilesDone() : mixed
Return values
mixed —downloadUpdate()
Downloads a zip archive of a given update and extracts it. If the zip extension is not available on the web server, the downloadUpdateFilesSeparately method will be used as a fallback.
public
downloadUpdate(AutoUpdaterUpdate $update, string $updateFilesDirectory[, int|null $lastDownloadedIndex = null ]) : mixed
Parameters
- $update : AutoUpdaterUpdate
- $updateFilesDirectory : string
- $lastDownloadedIndex : int|null = null
Tags
Return values
mixed —getLastDownloadedIndex()
public
getLastDownloadedIndex() : mixed
Return values
mixed —getProgress()
public
getProgress() : mixed
Return values
mixed —registerFtpManager()
Registers the auto updater ftp manager.
public
registerFtpManager(AutoUpdaterFtpManager $ftpManager) : mixed
Parameters
- $ftpManager : AutoUpdaterFtpManager
Return values
mixed —changeFileBasePath()
Replaces the base directory path of a given file path with a new base directory path.
protected
changeFileBasePath(string $file, string $oldBasePath, string $newBasePath) : string
Parameters
- $file : string
- $oldBasePath : string
- $newBasePath : string
Return values
string —Returns new path of the file. If an error occurs the unmodified file path will be returned.
checkUnpackedFiles()
Checks the unpacked files.
protected
checkUnpackedFiles(AutoUpdaterUpdate $update, string $updateFilesDirectory) : mixed
Parameters
- $update : AutoUpdaterUpdate
- $updateFilesDirectory : string
Tags
Return values
mixed —copyFile()
Copies a file.
protected
copyFile(string $source, string $destination) : bool
Parameters
- $source : string
- $destination : string
Return values
bool —createDebugLog()
Creates a new debug log.
protected
createDebugLog(string $message[, string|array<string|int, mixed> $additionalData = '' ]) : mixed
Parameters
- $message : string
- $additionalData : string|array<string|int, mixed> = ''
Return values
mixed —createDirectory()
Return true on success, otherwise false.
protected
createDirectory(string $directory[, bool $writable = false ]) : bool
Parameters
- $directory : string
-
Path of the new directory.
- $writable : bool = false
Return values
bool —deleteDirectory()
Deletes a directory. Return true on success and false otherwise.
protected
deleteDirectory(string $directory) : bool
Parameters
- $directory : string
Return values
bool —downloadExternalFile()
Downloads an external file with curl.
protected
downloadExternalFile(string $url, string $destination) : mixed
Parameters
- $url : string
- $destination : string
Return values
mixed —downloadUpdateFilesSeparately()
Downloads all update files of a given update into a given update files directory.
protected
downloadUpdateFilesSeparately(AutoUpdaterUpdate $update, string $updateFilesDirectory[, int|null $lastDownloadedIndex = null ]) : mixed
This method is a fallback, if the zip extension is not available on the web server.
Parameters
- $update : AutoUpdaterUpdate
- $updateFilesDirectory : string
- $lastDownloadedIndex : int|null = null
Tags
Return values
mixed —extractZip()
Extracts a given zip file to a given directory
protected
extractZip(string $zipFile, string $destination) : mixed
Parameters
- $zipFile : string
- $destination : string
Tags
Return values
mixed —getDirectoryFiles()
Returns an array with all files inside a given directory and his subdirectories.
protected
getDirectoryFiles(string $directory) : array<string|int, mixed>
Parameters
- $directory : string
Return values
array<string|int, mixed> —setCorrectChmodAndOwner()
Sets the file permissions and ownership correctly.
protected
setCorrectChmodAndOwner(string $file[, null|string $chmod = null ][, null|string $owner = null ]) : bool
Parameters
- $file : string
- $chmod : null|string = null
- $owner : null|string = null