[ Index ]
 

Code source de PHP PEAR 1.4.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/PEAR/ -> Downloader.php (sommaire)

PEAR_Downloader, the PEAR Installer's download utility class PHP versions 4 and 5

Author: Greg Beaver <cellog@php.net>
Author: Stig Bakken <ssb@php.net>
Author: Tomas V. V. Cox <cox@idecnet.com>
Author: Martin Jansen <mj@php.net>
Copyright: 1997-2006 The PHP Group
License: http://www.php.net/license/3_0.txt PHP License 3.0
Version: CVS: $Id: Downloader.php,v 1.121 2007/01/14 21:11:54 cellog Exp $
Poids: 1683 lignes (67 kb)
Inclus ou requis: 5 fois
Référencé: 0 fois
Nécessite: 11 fichiers
 PEAR/Dependency2.php
 Structures/Graph/Manipulator/TopologicalSorter.php
 PEAR/ChannelFile.php
 System.php
 PEAR/Common.php
 PEAR/Downloader/Package.php
 Structures/Graph/Node.php
 PEAR/PackageFile/v1.php
 PEAR/PackageFile.php
 PEAR/PackageFile/v2.php
 Structures/Graph.php

Définit 1 class

PEAR_Downloader:: (29 méthodes):
  PEAR_Downloader()
  discover()
  newDownloaderPackage()
  getDependency2Object()
  download()
  analyzeDependencies()
  getDownloadDir()
  setDownloadDir()
  configSet()
  setOptions()
  getOptions()
  getPackagefileObject()
  _getPackageDownloadUrl()
  _getDepPackageDownloadUrl()
  getPackageDownloadUrl()
  getDownloadedPackages()
  _downloadCallback()
  _prependPath()
  pushError()
  getErrorMsgs()
  sortPkgDeps()
  sortPackagesForInstall()
  _detectDepCycle()
  _testCycle()
  _setupGraph()
  _dependsOn()
  _checkDepTree()
  _sortInstall()
  downloadHttp()


Classe: PEAR_Downloader  - X-Ref

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

PEAR_Downloader(&$ui, $options, &$config)   X-Ref

param: PEAR_Frontend_*
param: array
param: PEAR_Config

discover($channel)   X-Ref
Attempt to discover a channel's remote capabilities from
its server name

param: string
return: boolean

newDownloaderPackage(&$t)   X-Ref
For simpler unit-testing

param: PEAR_Downloader
return: PEAR_Downloader_Package

getDependency2Object(&$c, $i, $p, $s)   X-Ref
For simpler unit-testing

param: PEAR_Config
param: array
param: array
param: int

download($params)   X-Ref
Pas de description

analyzeDependencies(&$params)   X-Ref

param: array all packages to be installed

getDownloadDir()   X-Ref
Retrieve the directory that downloads will happen in

return: string

setDownloadDir($dir)   X-Ref
Pas de description

configSet($key, $value, $layer = 'user', $channel = false)   X-Ref
Pas de description

setOptions($options)   X-Ref
Pas de description

getOptions()   X-Ref
Pas de description

getPackagefileObject(&$c, $d, $t = false)   X-Ref
For simpler unit-testing

param: PEAR_Config
param: int
param: string

_getPackageDownloadUrl($parr)   X-Ref

param: array output of {@link parsePackageName()}

_getDepPackageDownloadUrl($dep, $parr)   X-Ref

param: array dependency array

getPackageDownloadUrl($package, $version = null, $channel = false)   X-Ref


getDownloadedPackages()   X-Ref
Retrieve a list of downloaded packages after a call to {@link download()}.

Also resets the list of downloaded packages.
return: array

_downloadCallback($msg, $params = null)   X-Ref
Pas de description

_prependPath($path, $prepend)   X-Ref
Pas de description

pushError($errmsg, $code = -1)   X-Ref

param: string
param: integer

getErrorMsgs()   X-Ref
Pas de description

sortPkgDeps(&$packages, $uninstall = false)   X-Ref
for BC


sortPackagesForInstall(&$packages)   X-Ref
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.
param: array an array of downloaded PEAR_Downloader_Packages
return: array array of array(packagefilename, package.xml contents)

_detectDepCycle(&$deplinks)   X-Ref
Detect recursive links between dependencies and break the cycles

param: array

_testCycle($test, $deplinks, $dep)   X-Ref
Pas de description

_setupGraph($t, $reg, &$deplinks, &$nodes, $package)   X-Ref
Set up the dependency for installation parsing

param: array $t dependency information
param: PEAR_Registry $reg
param: array $deplinks list of dependency links already established
param: array $nodes all existing package nodes
param: string $package parent package name

_dependsOn($a, $b)   X-Ref
Pas de description

_checkDepTree($channel, $package, $b, $checked = array()   X-Ref
Pas de description

_sortInstall($a, $b)   X-Ref
Pas de description

downloadHttp($url, &$ui, $save_dir = '.', $callback = null, $lastmodified = null,$accept = false)   X-Ref
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.

param: string  $url       the URL to download
param: object  $ui        PEAR_Frontend_* instance
param: object  $config    PEAR_Config instance
param: string  $save_dir  directory to save file in
param: mixed   $callback  function/method to call for status
param: false|string|array $lastmodified header values to check against for caching
param: false|array $accept Accept headers to send
return: string|array  Returns the full path of the downloaded file or a PEAR



Généré le : Sun Feb 25 14:08:00 2007 par Balluche grâce à PHPXref 0.7