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

Class: PEAR_Downloader

Source Location: /PEAR-1.7.2/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.7.2

Copyright:

  • 1997-2008 The PHP Group

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::PEAR_Common()
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::PEAR()
Constructor. Registers this object in $_PEAR_destructor_object_list for destructor emulation if a destructor object exists.
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 independant PHP extension load. Remember to take care on the correct extension name for case sensitive OSes.
PEAR::popErrorHandling()
Pop the last error handler used
PEAR::popExpect()
This method pops one element off the expected error codes stack.
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::registerShutdownFunc()
Use this function to register a shutdown method for static classes.
PEAR::setErrorHandling()
Sets how errors generated by this object should be handled.
PEAR::staticPopErrorHandling()
PEAR::staticPushErrorHandling()
PEAR::throwError()
Simpler form of raiseError with fewer options. In most cases message, code and userinfo are enough.
PEAR::_PEAR()
Destructor (the emulated type of...). Does nothing right now, but is included for forward compatibility, so subclass destructors should always call it.

Class Details

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


[ Top ]


Method Detail

PEAR_Downloader (Constructor)   [line 161]

PEAR_Downloader PEAR_Downloader( PEAR_Frontend_* &$ui, array $options, PEAR_Config &$config)


Parameters:

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

[ Top ]

analyzeDependencies   [line 460]

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


Parameters:

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

[ Top ]

configSet   [line 721]

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


Parameters:

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

[ Top ]

discover   [line 197]

boolean discover( string $channel)

Attempt to discover a channel's remote capabilities from

its server name


Parameters:

string   $channel   — 

[ Top ]

download   [line 263]

void &download( $params)


Overridden in child classes as:

PEAR_Installer::download()
Download any files and their dependencies, if necessary

Parameters:

   $params   — 

[ Top ]

downloadHttp   [line 1546]

string|array downloadHttp( 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.
  • Access: public

Overrides PEAR_Common::downloadHttp() (Download a file through HTTP. Considers suggested file name in)

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
   &$ui   — 

[ Top ]

getDependency2Object   [line 254]

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 1120]

array getDownloadedPackages( )

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

Also resets the list of downloaded packages.


[ Top ]

getErrorMsgs   [line 1197]

void getErrorMsgs( )


[ Top ]

getOptions   [line 740]

void getOptions( )


[ Top ]

getPackageDownloadUrl   [line 1091]

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

  • Deprecated: in favor of _getPackageDownloadUrl

Parameters:

   $package   — 
   $version   — 
   $channel   — 

[ Top ]

getPackagefileObject   [line 753]

void &getPackagefileObject( PEAR_Config &$c, int $d, [string $t = false])

For simpler unit-testing

Parameters:

PEAR_Config   &$c   — 
int   $d   — 
string   $t   — 

[ Top ]

newDownloaderPackage   [line 238]

PEAR_Downloader_Package &newDownloaderPackage( PEAR_Downloader &$t)

For simpler unit-testing

Parameters:

PEAR_Downloader   &$t   — 

[ Top ]

pushError   [line 1189]

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


Parameters:

string   $errmsg   — 
integer   $code   — 

[ Top ]

setDownloadDir   [line 707]

void setDownloadDir( $dir)


Parameters:

   $dir   — 

[ Top ]

setOptions   [line 733]

void setOptions( $options)


Overridden in child classes as:

PEAR_Installer::setOptions()

Parameters:

   $options   — 

[ Top ]

sortPackagesForInstall   [line 1228]

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 1213]

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

for BC

Parameters:

   &$packages   — 
   $uninstall   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:21:49 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.