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

Class: PEAR_Installer

Source Location: /PEAR-1.6.2/PEAR/Installer.php

Class Overview

PEAR
   |
   --PEAR_Common
      |
      --PEAR_Downloader
         |
         --PEAR_Installer

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


Author(s):

Version:

  • Release: 1.6.2

Copyright:

  • 1997-2006 The PHP Group

Variables

Methods


Inherited Variables

Inherited Methods

Class: PEAR_Downloader

PEAR_Downloader::PEAR_Downloader()
PEAR_Downloader::analyzeDependencies()
PEAR_Downloader::configSet()
PEAR_Downloader::discover()
Attempt to discover a channel's remote capabilities from
PEAR_Downloader::download()
PEAR_Downloader::downloadHttp()
Download a file through HTTP. Considers suggested file name in
PEAR_Downloader::getDependency2Object()
For simpler unit-testing
PEAR_Downloader::getDownloadedPackages()
Retrieve a list of downloaded packages after a call to download().
PEAR_Downloader::getErrorMsgs()
PEAR_Downloader::getOptions()
PEAR_Downloader::getPackageDownloadUrl()
PEAR_Downloader::getPackagefileObject()
For simpler unit-testing
PEAR_Downloader::newDownloaderPackage()
For simpler unit-testing
PEAR_Downloader::pushError()
PEAR_Downloader::setDownloadDir()
PEAR_Downloader::setOptions()
PEAR_Downloader::sortPackagesForInstall()
Sort a list of arrays of array(downloaded packagefilename) by dependency.
PEAR_Downloader::sortPkgDeps()
for BC

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 49]
Administration class used to install PEAR packages and maintain the installed package database.


[ Top ]


Class Variables

$debug =  1

[line 82]

debug level

Type:   int


[ Top ]

$docdir =

[line 71]

directory where documentation goes

Type:   string


[ Top ]

$extdir =

[line 66]

directory where PHP extension files go

Type:   string


[ Top ]

$file_operations = array()

[line 112]

List of file transactions queued for an install/upgrade/uninstall.

Format: array(

  1. => array("rename => array("from-file", "to-file")),
  2. => array("delete" => array("file-to-delete")),
... )


Type:   array


[ Top ]

$installroot =  ''

[line 77]

installation root directory (ala PHP's INSTALL_ROOT or

automake's DESTDIR


Type:   string


[ Top ]

$phpdir =

[line 61]

directory where PHP code files go

Type:   string


[ Top ]

$pkgdir =

[line 56]

name of the package directory, for example Foo-1.0

Type:   string


[ Top ]

$registry =

[line 93]

PEAR_Registry object used by the installer

Type:   PEAR_Registry


[ Top ]

$tmpdir =

[line 87]

temporary directory

Type:   string


[ Top ]



Method Detail

PEAR_Installer (Constructor)   [line 125]

PEAR_Installer PEAR_Installer( &$ui, object $ui)

PEAR_Installer constructor.
  • Access: public

Parameters:

object   $ui   —  user interface object (instance of PEAR_Frontend_*)
   &$ui   — 

[ Top ]

addFileOperation   [line 649]

void addFileOperation( string $type, array $data)

Add a file operation to the current file transaction.

Parameters:

string   $type   —  This can be one of:
  • rename: rename a file ($data has 3 values)
  • backup: backup an existing file ($data has 1 value)
  • removebackup: clean up backups created during install ($data has 1 value)
  • chmod: change permissions on a file ($data has 2 values)
  • delete: delete a file ($data has 1 value)
  • rmdir: delete a directory if empty ($data has 1 value)
  • installed_as: mark a file as installed ($data has 4 values).
array   $data   — 

For all file operations, this array must contain the full path to the file or directory that is being operated on. For the rename command, the first parameter must be the file to rename, the second its new name, the third whether this is a PHP extension.

The installed_as operation contains 4 elements in this order:

  1. Filename as listed in the filelist element from package.xml
  2. Full path to the installed file
  3. Full path from the php_dir configuration variable used in this installation
  4. Relative path from the php_dir that this file is installed in


[ Top ]

commitFileTransaction   [line 678]

void commitFileTransaction( )


[ Top ]

download   [line 939]

void download( array $packages, PEAR_Config $options, array &$config, array &$installpackages, array &$errors, [false $installed = false], [false $willinstall = false], [false $state = false])

Download any files and their dependencies, if necessary
  • Deprecated: in favor of PEAR_Downloader

Overrides PEAR_Downloader::download() (parent method not documented)

Parameters:

array   $packages   —  a mixed list of package names, local files, or package.xml
PEAR_Config   $options   — 
array   &$config   —  options from the command line
array   &$installpackages   — 

this is the array that will be populated with packages to install. Format of each entry:

  1.  array('pkg' => 'package_name''file' => '/path/to/local/file',
  2.     'info' => array(// parsed package.xml
  3.  );

array   &$errors   —  this will be populated with any error messages
false   $installed   —  private recursion variable
false   $willinstall   —  private recursion variable
false   $state   —  private recursion variable

[ Top ]

getInstallPackages   [line 1019]

void getInstallPackages( )


[ Top ]

getUninstallPackages   [line 1473]

void &getUninstallPackages( )


[ Top ]

install   [line 1045]

array|PEAR_Error install( string|PEAR_Downloader_Package $pkgfile, [array $options = array()])

Installs the files within the package file specified.
  • Return: package info if successful

Parameters:

string|PEAR_Downloader_Package   $pkgfile   —  path to the package file, or a pre-initialized packagefile object
array   $options   —  recognized options:
  • installroot : optional prefix directory for installation
  • force : force installation
  • register-only : update registry but don't install files
  • upgrade : upgrade existing install
  • soft : fail silently
  • nodeps : ignore dependency conflicts/missing dependencies
  • alldeps : install all dependencies
  • onlyreqdeps : install only required dependencies

[ Top ]

mkDirHier   [line 910]

void mkDirHier( $dir)


Overrides PEAR_Common::mkDirHier() (Wrapper to System::mkDir(), creates a directory as well as any necessary parent directories.)

Parameters:

   $dir   — 

[ Top ]

rollbackFileTransaction   [line 864]

void rollbackFileTransaction( )


[ Top ]

setConfig   [line 137]

void setConfig( &$config)


Parameters:

   &$config   — 

[ Top ]

setDownloadedPackages   [line 998]

void setDownloadedPackages( array &$pkgs)

Set the list of PEAR_Downloader_Package objects to allow more sane

dependency validation


Parameters:

array   &$pkgs   — 

[ Top ]

setOptions   [line 132]

void setOptions( $options)


Overrides PEAR_Downloader::setOptions() (parent method not documented)

Parameters:

   $options   — 

[ Top ]

setUninstallPackages   [line 1014]

void setUninstallPackages( array &$pkgs)

Set the list of PEAR_Downloader_Package objects to allow more sane

dependency validation


Parameters:

array   &$pkgs   — 

[ Top ]

sortPackagesForUninstall   [line 1616]

array|PEAR_Error sortPackagesForUninstall( array &$packages)

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

It also removes duplicate dependencies

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

Parameters:

array   &$packages   —  an array of PEAR_PackageFile_v[1/2] objects

[ Top ]

startFileTransaction   [line 667]

void startFileTransaction( [ $rollback_in_case = false])


Parameters:

   $rollback_in_case   — 

[ Top ]

uninstall   [line 1492]

void uninstall( string $package, [array $options = array()])

Uninstall a package

This method removes all files installed by the application, and then removes any empty directories.


Parameters:

string   $package   —  package name
array   $options   — 

Command-line options. Possibilities include:

  • installroot: base installation dir, if not the default
  • register-only : update registry but don't remove files
  • nodeps: do not process dependencies of other packages to ensure uninstallation does not break things


[ Top ]

_deletePackageFiles   [line 163]

bool _deletePackageFiles( string $package, [string $channel = false], [bool $backup = false])

Delete a package's installed files, does not remove empty directories.
  • Return: TRUE on success, or a PEAR error on failure
  • Access: protected

Parameters:

string   $package   —  package name
string   $channel   —  channel name
bool   $backup   —  if true, then files are backed up first

[ Top ]


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