PHP Class PEAR_Downloader_Package

Input can come from three sources: - local files (archives or package.xml) - remote files (downloadable urls) - abstract package names The first two elements are handled cleanly by PEAR_PackageFile, but the third requires accessing pearweb's xml-rpc interface to determine necessary dependencies, and the format returned of dependencies is slightly different from that used in package.xml. This class hides the differences between these elements, and makes automatic dependency resolution a piece of cake. It also manages conflicts when two classes depend on incompatible dependencies, or differing versions of the same package dependency. In addition, download will not be attempted if the php version is not supported, PEAR installer version is not supported, or non-PECL extensions are not installed.
Mostra file Open project: sourcefabric/newscoop Class Usage Examples

Public Properties

Property Type Description
$_analyzed boolean
$_config PEAR_Config
$_downloadDeps array
$_downloadURL array
$_downloader PEAR_Downloader
$_explicitGroup If this package is invoked with Package#group, this variable will be true
$_explicitState string | false This allows temporary reassignment of preferred_state for a parent package and all of its dependencies.
$_installRegistry PEAR_Registry Used to implement packagingroot properly
$_packagefile PEAR_PackageFile_v1 | PEAR_PackageFile | v2
$_parsedname array
$_rawpackagefile string | false Contents of package.xml, if downloaded from a remote channel
$_registry PEAR_Registry
$_type string Package type local|url
$_valid boolean
$_validated boolean

Public Methods

Method Description
PEAR_Downloader_Package ( &$downloader )
_analyzeDownloadURL ( $info, $param, $pname, $params = null, $optional = false, $isdependency = false )
_detect1 ( $deps, $pname, $options, $params )
_detect2 ( $deps, $pname, $options, $params )
_detect2Dep ( $dep, $pname, $group, $params )
_fromFile ( &$param ) This will retrieve from a local file if possible, and parse out a group name as well. The original parameter will be modified to reflect this.
_fromString ( $param )
_fromUrl ( $param, $saveparam = '' )
alreadyValidated ( )
canDefault ( )
detectDependencies ( $params )
detectStupidDuplicates ( array $params, array &$errorparams ) : array Detect duplicate package names with differing versions
download ( ) : PEAR_PackageFile_v1 | PEAR_PackageFile_v2 | PEAR_Error Retrieve any non-local packages
explicitState ( )
fromDepURL ( $dep ) Like {@link initialize()}, but operates on a dependency
getChannel ( )
getDeps ( )
getDownloadURL ( )
getDownloader ( )
getGroup ( )
getPackage ( )
getPackageFile ( )
getPackageType ( )
getPackageXmlVersion ( )
getPackagefileObject ( &$c, $d ) For simpler unit-testing
getParsedPackage ( )
getShortName ( )
getType ( )
getURI ( )
getVersion ( )
initialize ( $param ) : boolean | PEAR_Error Parse the input and determine whether this is a local file, a remote uri, or an abstract package name.
isBundle ( )
isCompatible ( $pf )
isEqual ( $param )
isExtension ( $name )
isInstalled ( $dep, $oper = '==' )
isSubpackage ( &$pf )
mergeDependencies ( &$params )
removeDuplicates ( &$params, $ignoreGroups = false )
removeInstalled ( &$params ) Remove packages to be downloaded that are already installed
setDownloadURL ( $pkg )
setExplicitState ( $s )
setGroup ( $group )
setPackageFile ( PEAR_PackageFile_v1 | PEAR_PackageFile_v2 &$pkg ) Set the package.xml object for this downloaded package
setValidated ( )
willDownload ( $param, $params )

Method Details

PEAR_Downloader_Package() public method

public PEAR_Downloader_Package ( &$downloader )

_analyzeDownloadURL() public method

public _analyzeDownloadURL ( $info, $param, $pname, $params = null, $optional = false, $isdependency = false )

_detect1() public method

public _detect1 ( $deps, $pname, $options, $params )

_detect2() public method

public _detect2 ( $deps, $pname, $options, $params )

_detect2Dep() public method

public _detect2Dep ( $dep, $pname, $group, $params )

_fromFile() public method

This will retrieve from a local file if possible, and parse out a group name as well. The original parameter will be modified to reflect this.
public _fromFile ( &$param )

_fromString() public method

public _fromString ( $param )

_fromUrl() public method

public _fromUrl ( $param, $saveparam = '' )

alreadyValidated() public method

public alreadyValidated ( )

canDefault() public method

public canDefault ( )

detectDependencies() public method

public detectDependencies ( $params )

detectStupidDuplicates() public method

If a user requests to install Date 1.4.6 and Date 1.4.7, for instance, this is a logic error. This method detects this situation.
public detectStupidDuplicates ( array $params, array &$errorparams ) : array
$params array array of PEAR_Downloader_Package objects
$errorparams array empty array
return array array of stupid duplicated packages in PEAR_Downloader_Package obejcts

download() public method

Retrieve any non-local packages
public download ( ) : PEAR_PackageFile_v1 | PEAR_PackageFile_v2 | PEAR_Error
return PEAR_PackageFile_v1 | PEAR_PackageFile_v2 | PEAR_Error

explicitState() public method

public explicitState ( )

fromDepURL() public method

Like {@link initialize()}, but operates on a dependency
public fromDepURL ( $dep )

getChannel() public method

public getChannel ( )

getDeps() public method

public getDeps ( )

getDownloadURL() public method

public getDownloadURL ( )

getDownloader() public method

public getDownloader ( )

getGroup() public method

public getGroup ( )

getPackage() public method

public getPackage ( )

getPackageFile() public method

public getPackageFile ( )

getPackageType() public method

public getPackageType ( )

getPackageXmlVersion() public method

getPackagefileObject() public method

For simpler unit-testing
public getPackagefileObject ( &$c, $d )

getParsedPackage() public method

public getParsedPackage ( )

getShortName() public method

public getShortName ( )

getType() public method

public getType ( )

getURI() public method

public getURI ( )

getVersion() public method

public getVersion ( )

initialize() public method

This is the heart of the PEAR_Downloader_Package(), and is used in {@link PEAR_Downloader::download()}
public initialize ( $param ) : boolean | PEAR_Error
return boolean | PEAR_Error

isBundle() public method

public isBundle ( )

isCompatible() public method

public isCompatible ( $pf )

isEqual() public method

public isEqual ( $param )

isExtension() public method

public isExtension ( $name )

isInstalled() public method

public isInstalled ( $dep, $oper = '==' )

isSubpackage() public method

public isSubpackage ( &$pf )

mergeDependencies() public method

public mergeDependencies ( &$params )

removeDuplicates() public method

public removeDuplicates ( &$params, $ignoreGroups = false )

removeInstalled() public method

Remove packages to be downloaded that are already installed
public removeInstalled ( &$params )

setDownloadURL() public method

public setDownloadURL ( $pkg )

setExplicitState() public method

public setExplicitState ( $s )

setGroup() public method

public setGroup ( $group )

setPackageFile() public method

Set the package.xml object for this downloaded package
public setPackageFile ( PEAR_PackageFile_v1 | PEAR_PackageFile_v2 &$pkg )
$pkg PEAR_PackageFile_v1 | PEAR_PackageFile_v2

setValidated() public method

public setValidated ( )

willDownload() public method

public willDownload ( $param, $params )

Property Details

$_analyzed public_oe property

public bool $_analyzed
return boolean

$_config public_oe property

public PEAR_Config $_config
return PEAR_Config

$_downloadDeps public_oe property

public array $_downloadDeps
return array

$_downloadURL public_oe property

public array $_downloadURL
return array

$_downloader public_oe property

public PEAR_Downloader $_downloader
return PEAR_Downloader

$_explicitGroup public_oe property

If this package is invoked with Package#group, this variable will be true
public $_explicitGroup

$_explicitState public_oe property

This allows temporary reassignment of preferred_state for a parent package and all of its dependencies.
public string|false $_explicitState
return string | false

$_installRegistry public_oe property

Used to implement packagingroot properly
public PEAR_Registry $_installRegistry
return PEAR_Registry

$_packagefile public_oe property

public PEAR_PackageFile_v1|PEAR_PackageFile|v2 $_packagefile
return PEAR_PackageFile_v1 | PEAR_PackageFile | v2

$_parsedname public_oe property

public array $_parsedname
return array

$_rawpackagefile public_oe property

Contents of package.xml, if downloaded from a remote channel
public string|false $_rawpackagefile
return string | false

$_registry public_oe property

public PEAR_Registry $_registry
return PEAR_Registry

$_type public_oe property

Package type local|url
public string $_type
return string

$_valid public_oe property

public bool $_valid
return boolean

$_validated public_oe property

public bool $_validated
return boolean