PHP 클래스 PEAR_Downloader

저자: Greg Beaver ([email protected])
저자: Stig Bakken ([email protected])
저자: Tomas V. V. Cox ([email protected])
저자: Martin Jansen ([email protected])
상속: extends PEAR_Common
파일 보기 프로젝트 열기: sourcefabric/newscoop 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$_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