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.
Afficher le fichier Open project: sourcefabric/newscoop Class Usage Examples

Méthodes publiques

Свойство 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

Méthodes publiques

Méthode 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 méthode

public PEAR_Downloader_Package ( &$downloader )

_analyzeDownloadURL() public méthode

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

_detect1() public méthode

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

_detect2() public méthode

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

_detect2Dep() public méthode

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

_fromFile() public méthode

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 méthode

public _fromString ( $param )

_fromUrl() public méthode

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

alreadyValidated() public méthode

public alreadyValidated ( )

canDefault() public méthode

public canDefault ( )

detectDependencies() public méthode

public detectDependencies ( $params )

detectStupidDuplicates() public méthode

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
Résultat array array of stupid duplicated packages in PEAR_Downloader_Package obejcts

download() public méthode

Retrieve any non-local packages
public download ( ) : PEAR_PackageFile_v1 | PEAR_PackageFile_v2 | PEAR_Error
Résultat PEAR_PackageFile_v1 | PEAR_PackageFile_v2 | PEAR_Error

explicitState() public méthode

public explicitState ( )

fromDepURL() public méthode

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

getChannel() public méthode

public getChannel ( )

getDeps() public méthode

public getDeps ( )

getDownloadURL() public méthode

public getDownloadURL ( )

getDownloader() public méthode

public getDownloader ( )

getGroup() public méthode

public getGroup ( )

getPackage() public méthode

public getPackage ( )

getPackageFile() public méthode

public getPackageFile ( )

getPackageType() public méthode

public getPackageType ( )

getPackageXmlVersion() public méthode

getPackagefileObject() public méthode

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

getParsedPackage() public méthode

public getParsedPackage ( )

getShortName() public méthode

public getShortName ( )

getType() public méthode

public getType ( )

getURI() public méthode

public getURI ( )

getVersion() public méthode

public getVersion ( )

initialize() public méthode

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

isBundle() public méthode

public isBundle ( )

isCompatible() public méthode

public isCompatible ( $pf )

isEqual() public méthode

public isEqual ( $param )

isExtension() public méthode

public isExtension ( $name )

isInstalled() public méthode

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

isSubpackage() public méthode

public isSubpackage ( &$pf )

mergeDependencies() public méthode

public mergeDependencies ( &$params )

removeDuplicates() public méthode

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

removeInstalled() public méthode

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

setDownloadURL() public méthode

public setDownloadURL ( $pkg )

setExplicitState() public méthode

public setExplicitState ( $s )

setGroup() public méthode

public setGroup ( $group )

setPackageFile() public méthode

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 méthode

public setValidated ( )

willDownload() public méthode

public willDownload ( $param, $params )

Property Details

$_analyzed public_oe property

public bool $_analyzed
Résultat boolean

$_config public_oe property

public PEAR_Config $_config
Résultat PEAR_Config

$_downloadDeps public_oe property

public array $_downloadDeps
Résultat array

$_downloadURL public_oe property

public array $_downloadURL
Résultat array

$_downloader public_oe property

public PEAR_Downloader $_downloader
Résultat 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
Résultat string | false

$_installRegistry public_oe property

Used to implement packagingroot properly
public PEAR_Registry $_installRegistry
Résultat PEAR_Registry

$_packagefile public_oe property

public PEAR_PackageFile_v1|PEAR_PackageFile|v2 $_packagefile
Résultat PEAR_PackageFile_v1 | PEAR_PackageFile | v2

$_parsedname public_oe property

public array $_parsedname
Résultat array

$_rawpackagefile public_oe property

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

$_registry public_oe property

public PEAR_Registry $_registry
Résultat PEAR_Registry

$_type public_oe property

Package type local|url
public string $_type
Résultat string

$_valid public_oe property

public bool $_valid
Résultat boolean

$_validated public_oe property

public bool $_validated
Résultat boolean