PEAR
[ class tree: PEAR ] [ index: PEAR ] [ all elements ]

Class: PEAR_Downloader

Source Location: /PEAR-1.10.0dev2/PEAR/Downloader.php

Class Overview

PEAR
   |
   --PEAR_Common
      |
      --PEAR_Downloader

Administration class used to download anything from the internet (PEAR Packages, static URLs, xml files)


Author(s):

Version:

  • Release: 1.10.0dev2

Copyright:

  • 1997-2009 The Authors

Variables

Methods


Child classes:

PEAR_Installer
Administration class used to install PEAR packages and maintain the installed package database.

Inherited Variables

Inherited Methods

Class: PEAR_Common

PEAR_Common::__construct()
PEAR_Common constructor
PEAR_Common::addTempFile()
Register a temporary file or directory. When the destructor is executed, all registered temporary files and directories are removed.
PEAR_Common::analyzeSourceCode()
Analyze the source code of the given PHP file
PEAR_Common::betterStates()
Return an array containing all of the states that are more stable than or equal to the passed in state
PEAR_Common::buildProvidesArray()
Build a "provides" array from data returned by analyzeSourceCode(). The format of the built array is like this:
PEAR_Common::detectDependencies()
PEAR_Common::downloadHttp()
Download a file through HTTP. Considers suggested file name in
PEAR_Common::getDependencyRelations()
Get the implemented dependency relations (has, lt, ge etc.)
PEAR_Common::getDependencyTypes()
Get the implemented dependency types (php, ext, pkg etc.)
PEAR_Common::getFileRoles()
Get the implemented file roles
PEAR_Common::getProvideTypes()
Get the implemented file replacement types in
PEAR_Common::getReleaseStates()
Get the valid package release states of packages
PEAR_Common::getReplacementTypes()
Get the implemented file replacement types in
PEAR_Common::getScriptPhases()
Get the implemented file replacement types in
PEAR_Common::getUserRoles()
Get the valid roles for a PEAR package maintainer
PEAR_Common::infoFromAny()
Returns package information from different sources
PEAR_Common::infoFromDescriptionFile()
Returns information about a package file. Expects the name of a package xml file as input.
PEAR_Common::infoFromString()
Returns information about a package file. Expects the contents of a package xml file as input.
PEAR_Common::infoFromTgzFile()
Returns information about a package file. Expects the name of a gzipped tar file as input.
PEAR_Common::isIncludeable()
PEAR_Common::log()
Logging method.
PEAR_Common::mkDirHier()
Wrapper to System::mkDir(), creates a directory as well as any necessary parent directories.
PEAR_Common::mkTempDir()
Create and register a temporary directory.
PEAR_Common::setFrontendObject()
Set object that represents the frontend to be used.
PEAR_Common::validatePackageInfo()
Validate XML package definition file.
PEAR_Common::validPackageName()
Test whether a string contains a valid package name.
PEAR_Common::validPackageVersion()
Test whether a string contains a valid package version.
PEAR_Common::xmlFromInfo()
Return an XML document based on the package info (as returned by the PEAR_Common::infoFrom* methods).

Class: PEAR

PEAR::__construct()
Constructor. Registers this object in $_PEAR_destructor_object_list for destructor emulation if a destructor object exists.
PEAR::PEAR()
Only here for backwards compatibility.
PEAR::delExpect()
This method deletes all occurences of the specified element from the expected error codes stack.
PEAR::expectError()
This method is used to tell which errors you expect to get.
PEAR::getStaticProperty()
If you have a class that's mostly/entirely static, and you need static
PEAR::isError()
Tell whether a value is a PEAR error.
PEAR::loadExtension()
OS independent PHP extension load. Remember to take care on the correct extension name for case sensitive OSes.
PEAR::popExpect()
This method pops one element off the expected error codes stack.
PEAR::registerShutdownFunc()
Use this function to register a shutdown method for static classes.
PEAR::staticPopErrorHandling()
PEAR::staticPushErrorHandling()
PEAR::_PEAR()
Destructor (the emulated type of...). Does nothing right now, but is included for forward compatibility, so subclass destructors should always call it.
PEAR::_popErrorHandling()
Pop the last error handler used
PEAR::_pushErrorHandling()
Push a new error handler on top of the error handler options stack. With this you can easily override the actual error handler for some code and restore it later with popErrorHandling.
PEAR::_raiseError()
This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied. If the $mode and $options parameters are not specified, the object's defaults are used.
PEAR::_setErrorHandling()
Sets how errors generated by this object should be handled.
PEAR::_throwError()
Simpler form of raiseError with fewer options. In most cases message, code and userinfo are enough.
PEAR::__call()
PEAR::__callStatic()

Class Details

[line 45]
Administration class used to download anything from the internet (PEAR Packages, static URLs, xml files)


[ Top ]


Class Variables

$bivalentMethods = array(
        'setErrorHandling' => true,
        'raiseError' => true,
        'throwError' => true,
        'pushErrorHandling' => true,
        'popErrorHandling' => true,
        'downloadHttp' => true,
    )

[line 146]

List of methods that can be called both statically and non-statically.
  • Access: protected

Type:   array
Overrides:   Array


[ Top ]



Method Detail

__construct (Constructor)   [line 160]

PEAR_Downloader __construct( [PEAR_Frontend_* $ui = null], [array $options = array()], [PEAR_Config $config = null])


Overridden in child classes as:

PEAR_Installer::__construct()
PEAR_Installer constructor.

Overrides PEAR_Common::__construct() (PEAR_Common constructor)

Parameters:

PEAR_Frontend_*   $ui   — 
array   $options   — 
PEAR_Config   $config   — 

[ Top ]

analyzeDependencies   [line 514]

void analyzeDependencies( array &$params, [ $force = false])


Parameters:

array   &$params   —  all packages to be installed
   $force   — 

[ Top ]

configSet   [line 784]

void configSet( $key, $value, [ $layer = 'user'], [ $channel = false])


Parameters:

   $key   — 
   $value   — 
   $layer   — 
   $channel   — 

[ Top ]

discover   [line 199]

boolean discover( string $channel)

Attempt to discover a channel's remote capabilities from

its server name


Parameters:

string   $channel   — 

[ Top ]

download   [line 279]

void &download( $params)


Parameters:

   $params   — 

[ Top ]

getDependency2Object   [line 270]

void &getDependency2Object( PEAR_Config &$c, array $i, array $p, int $s)

For simpler unit-testing

Parameters:

PEAR_Config   &$c   — 
array   $i   — 
array   $p   — 
int   $s   — 

[ Top ]

getDownloadedPackages   [line 1112]

array getDownloadedPackages( )

Retrieve a list of downloaded packages after a call to download().

Also resets the list of downloaded packages.


[ Top ]

getErrorMsgs   [line 1178]

void getErrorMsgs( )


[ Top ]

getOptions   [line 799]

void getOptions( )


[ Top ]

getPackageDownloadUrl   [line 1086]

void getPackageDownloadUrl( $package, [ $version = null], [ $channel = false])

  • Deprecated: in favor of _getPackageDownloadUrl

Parameters:

   $package   — 
   $version   — 
   $channel   — 

[ Top ]

newDownloaderPackage   [line 254]

PEAR_Downloader_Package newDownloaderPackage( PEAR_Downloader &$t)

For simpler unit-testing

Parameters:

PEAR_Downloader   &$t   — 

[ Top ]

pushError   [line 1173]

void pushError( string $errmsg, [integer $code = -1])


Parameters:

string   $errmsg   — 
integer   $code   — 

[ Top ]

setDownloadDir   [line 772]

void setDownloadDir( $dir)


Parameters:

   $dir   — 

[ Top ]

setOptions   [line 794]

void setOptions( $options)


Overridden in child classes as:

PEAR_Installer::setOptions()

Parameters:

   $options   — 

[ Top ]

sortPackagesForInstall   [line 1209]

array sortPackagesForInstall( array &$packages)

Sort a list of arrays of array(downloaded packagefilename) by dependency.

This uses the topological sort method from graph theory, and the Structures_Graph package to properly sort dependencies for installation.

  • Return: array of array(packagefilename, package.xml contents)

Parameters:

array   &$packages   —  an array of downloaded PEAR_Downloader_Packages

[ Top ]

sortPkgDeps   [line 1194]

void sortPkgDeps( &$packages, [ $uninstall = false])

for BC
  • Deprecated:

Parameters:

   &$packages   — 
   $uninstall   — 

[ Top ]

_downloadHttp   [line 1556]

mixed _downloadHttp( $object, string $url, &$ui, [string $save_dir = '.'], [mixed $callback = null], [false|string|array $lastmodified = null], [false|array $accept = false], [false|string $channel = false], object $ui, object $config)

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:

'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.

  • Return: 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. If $lastmodified was given and the there are no changes, boolean false is returned.
  • Access: public

Parameters:

string   $url   —  the URL to download
object   $ui   —  PEAR_Frontend_* instance
object   $config   —  PEAR_Config instance
string   $save_dir   —  directory to save file in
mixed   $callback   —  function/method to call for status updates
false|string|array   $lastmodified   —  header values to check against for caching use false to return the header values from this download
false|array   $accept   —  Accept headers to send
false|string   $channel   —  Channel to use for retrieving authentication
   $object   — 
   &$ui   — 

[ Top ]


Documentation generated on Fri, 31 Jul 2015 09:30:21 +0000 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.