PHP Класс PEAR_Downloader

Автор: Greg Beaver ([email protected])
Автор: Stig Bakken ([email protected])
Автор: Tomas V. V. Cox ([email protected])
Автор: Martin Jansen ([email protected])
Наследование: extends PEAR_Common
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$_downloadDir string Temporary directory, or configuration value where downloads will occur
$_downloadedPackages array Format of each entry: array('pkg' => 'package_name', 'file' => '/path/to/local/file', 'info' => array() // parsed package.xml );
$_errorStack array
$_installed array Format: array('package1' => 0, 'package2' => 1, );
$_internalDownload boolean
$_options array Recognized options:
- onlyreqdeps : install all required dependencies as well - alldeps : install all dependencies, including optional - installroot : base relative path to install files in - force : force a download even if warnings would prevent it - nocompress : download uncompressed tarballs
$_packageSortTree array Temporary variable used in sorting packages by dependency in {@link sortPkgDeps()}
$_preferredState string | null Preferred Installation State (snapshot, devel, alpha, beta, stable)
$_registry PEAR_Registry
$_toDownload array This is used to prevent downloading a package more than once should it be a dependency for two packages to be installed. Format of each entry:
array('package_name1' => parsed package.xml, 'package_name2' => parsed package.xml,
);

Открытые методы

Метод Описание
PEAR_Downloader ( &$ui, $options, &$config )
_checkDepTree ( $channel, $package, $b, $checked = [] )
_dependsOn ( $a, $b )
_detectDepCycle ( &$deplinks ) Detect recursive links between dependencies and break the cycles
_downloadCallback ( $msg, $params = null )
_getDepPackageDownloadUrl ( $dep, $parr )
_getPackageDownloadUrl ( $parr )
_prependPath ( $path, $prepend )
_setupGraph ( array $t, PEAR_Registry $reg, array &$deplinks, array &$nodes, string $package ) Set up the dependency for installation parsing
_sortInstall ( $a, $b )
_testCycle ( $test, $deplinks, $dep )
analyzeDependencies ( &$params, $force = false )
configSet ( $key, $value, $layer = 'user', $channel = false )
discover ( $channel ) : boolean Attempt to discover a channel's remote capabilities from its server name
download ( $params )
downloadHttp ( string $url, object &$ui, string $save_dir = '.', mixed $callback = null, false | string | array $lastmodified = null, false | array $accept = false, false | string $channel = false ) : string | array Download a file through HTTP. Considers suggested file name in Content-disposition: header and can run a callback function for different events. The callback will be called with two parameters: the callback type, and parameters. The implemented callback types are:
getDependency2Object ( &$c, $i, $p, $s ) For simpler unit-testing
getDownloadDir ( ) : string Retrieve the directory that downloads will happen in
getDownloadedPackages ( ) : array Retrieve a list of downloaded packages after a call to {@link download()}.
getErrorMsgs ( )
getOptions ( )
getPackageDownloadUrl ( $package, $version = null, $channel = false )
newDownloaderPackage ( &$t ) : PEAR_Downloader_Package For simpler unit-testing
pushError ( $errmsg, $code )
setDownloadDir ( $dir )
setOptions ( $options )
sortPackagesForInstall ( &$packages ) : array Sort a list of arrays of array(downloaded packagefilename) by dependency.
sortPkgDeps ( &$packages, $uninstall = false ) for BC

Описание методов

PEAR_Downloader() публичный Метод

public PEAR_Downloader ( &$ui, $options, &$config )

_checkDepTree() публичный Метод

public _checkDepTree ( $channel, $package, $b, $checked = [] )

_dependsOn() публичный Метод

public _dependsOn ( $a, $b )

_detectDepCycle() публичный Метод

Detect recursive links between dependencies and break the cycles
public _detectDepCycle ( &$deplinks )

_downloadCallback() публичный Метод

public _downloadCallback ( $msg, $params = null )

_getDepPackageDownloadUrl() публичный Метод

public _getDepPackageDownloadUrl ( $dep, $parr )

_getPackageDownloadUrl() публичный Метод

public _getPackageDownloadUrl ( $parr )

_prependPath() публичный Метод

public _prependPath ( $path, $prepend )

_setupGraph() публичный Метод

Set up the dependency for installation parsing
public _setupGraph ( array $t, PEAR_Registry $reg, array &$deplinks, array &$nodes, string $package )
$t array dependency information
$reg PEAR_Registry
$deplinks array list of dependency links already established
$nodes array all existing package nodes
$package string parent package name

_sortInstall() публичный Метод

public _sortInstall ( $a, $b )

_testCycle() публичный Метод

public _testCycle ( $test, $deplinks, $dep )

analyzeDependencies() публичный Метод

public analyzeDependencies ( &$params, $force = false )

configSet() публичный Метод

public configSet ( $key, $value, $layer = 'user', $channel = false )

discover() публичный Метод

Attempt to discover a channel's remote capabilities from its server name
public discover ( $channel ) : boolean
Результат boolean

download() публичный Метод

public download ( $params )

downloadHttp() публичный Метод

'setup' called at the very beginning, parameter is a UI object that should be used for all output 'message' the parameter is a string with an informational message 'saveas' may be used to save with a different file name, the parameter is the filename that is about to be used. If a 'saveas' callback returns a non-empty string, that file name will be used as the filename instead. Note that $save_dir will not be affected by this, only the basename of the file. 'start' download is starting, parameter is number of bytes that are expected, or -1 if unknown 'bytesread' parameter is the number of bytes read so far 'done' download is complete, parameter is the total number of bytes read 'connfailed' if the TCP/SSL connection fails, this callback is called with array(host,port,errno,errmsg) 'writefailed' if writing to disk fails, this callback is called with array(destfile,errmsg) If an HTTP proxy has been configured (http_proxy PEAR_Config setting), the proxy will be used.
public downloadHttp ( string $url, object &$ui, string $save_dir = '.', mixed $callback = null, false | string | array $lastmodified = null, false | array $accept = false, false | string $channel = false ) : string | array
$url string the URL to download
$ui object PEAR_Frontend_* instance
$save_dir string directory to save file in
$callback mixed function/method to call for status updates
$lastmodified false | string | array header values to check against for caching use false to return the header values from this download
$accept false | array Accept headers to send
$channel false | string Channel to use for retrieving authentication
Результат string | array Returns the full path of the downloaded file or a PEAR error on failure. If the error is caused by socket-related errors, the error object will have the fsockopen error code available through getCode(). If caching is requested, then return the header values.

getDependency2Object() публичный Метод

For simpler unit-testing
public getDependency2Object ( &$c, $i, $p, $s )

getDownloadDir() публичный Метод

Retrieve the directory that downloads will happen in
public getDownloadDir ( ) : string
Результат string

getDownloadedPackages() публичный Метод

Also resets the list of downloaded packages.
public getDownloadedPackages ( ) : array
Результат array

getErrorMsgs() публичный Метод

public getErrorMsgs ( )

getOptions() публичный Метод

public getOptions ( )

getPackageDownloadUrl() публичный Метод

Устаревший: in favor of _getPackageDownloadUrl
public getPackageDownloadUrl ( $package, $version = null, $channel = false )

newDownloaderPackage() публичный Метод

For simpler unit-testing
public newDownloaderPackage ( &$t ) : PEAR_Downloader_Package
Результат PEAR_Downloader_Package

pushError() публичный Метод

public pushError ( $errmsg, $code )

setDownloadDir() публичный Метод

public setDownloadDir ( $dir )

setOptions() публичный Метод

public setOptions ( $options )

sortPackagesForInstall() публичный Метод

This uses the topological sort method from graph theory, and the Structures_Graph package to properly sort dependencies for installation.
public sortPackagesForInstall ( &$packages ) : array
Результат array array of array(packagefilename, package.xml contents)

sortPkgDeps() публичный Метод

for BC
Устаревший:
public sortPkgDeps ( &$packages, $uninstall = false )

Описание свойств

$_downloadDir публичное свойство

Temporary directory, or configuration value where downloads will occur
public string $_downloadDir
Результат string

$_downloadedPackages публичное свойство

Format of each entry: array('pkg' => 'package_name', 'file' => '/path/to/local/file', 'info' => array() // parsed package.xml );
public array $_downloadedPackages
Результат array

$_errorStack публичное свойство

public array $_errorStack
Результат array

$_installed публичное свойство

Format: array('package1' => 0, 'package2' => 1, );
public array $_installed
Результат array

$_internalDownload публичное свойство

public bool $_internalDownload
Результат boolean

$_options публичное свойство

Recognized options:
- onlyreqdeps : install all required dependencies as well - alldeps : install all dependencies, including optional - installroot : base relative path to install files in - force : force a download even if warnings would prevent it - nocompress : download uncompressed tarballs
См. также: PEAR_Command_Install
public array $_options
Результат array

$_packageSortTree публичное свойство

Temporary variable used in sorting packages by dependency in {@link sortPkgDeps()}
public array $_packageSortTree
Результат array

$_preferredState публичное свойство

Preferred Installation State (snapshot, devel, alpha, beta, stable)
public string|null $_preferredState
Результат string | null

$_registry публичное свойство

public PEAR_Registry $_registry
Результат PEAR_Registry

$_toDownload публичное свойство

This is used to prevent downloading a package more than once should it be a dependency for two packages to be installed. Format of each entry:
array('package_name1' => parsed package.xml, 'package_name2' => parsed package.xml,
);
public array $_toDownload
Результат array