Class PEAR_Installer

Description

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

TODO:

  • Check dependencies break on package uninstall (when no force given)
  • add a guessInstallDest() method with the code from _installFile() and use that method in Registry::_rebuildFileMap() & Command_Registry::doList(), others..

Located in /maintenance/libraries/pear/PEAR/Installer.php (line 40)

PEAR
   |
   --PEAR_Common
      |
      --PEAR_Downloader
         |
         --PEAR_Installer
Variable Summary
 int $debug
 string $docdir
 string $extdir
 string $installroot
 string $phpdir
 string $pkgdir
 object $registry
 string $tmpdir
Method Summary
 PEAR_Installer PEAR_Installer (object &$ui)
 void addFileOperation (mixed $type, mixed $data)
 boolean checkDeps (array &$pkginfo, string &$errors)
 void download (array $packages, PEAR_Config $options, array &$config, array &$installpackages, array &$errors, [false $installed = false], [false $willinstall = false], [false $state = false])
 array|PEAR_Error install (string $pkgfile, [mixed $options = array()], array $options )
 void mkDirHier (mixed $dir)
 void startFileTransaction ([mixed $rollback_in_case = false])
 void uninstall (string $package, [array $options = array()])
 void _buildCallback (mixed $what, mixed $data)
 bool _deletePackageFiles (string $package)
 void _installFile (string $file, array $atts, string $tmp_path, array $options)
 void _sortDirs (mixed $a, mixed $b)
Variables
int $debug = 1 (line 73)

debug level

string $docdir (line 62)

directory where documentation goes

string $extdir (line 57)

directory where PHP extension files go

array $file_operations = array() (line 96)

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")),
... )

string $installroot = '' (line 68)

installation root directory (ala PHP's INSTALL_ROOT or

automake's DESTDIR

string $phpdir (line 52)

directory where PHP code files go

string $pkgdir (line 47)

name of the package directory, for example Foo-1.0

object $registry (line 83)

PEAR_Registry object used by the installer

string $tmpdir (line 78)

temporary directory

Inherited Variables

Inherited from PEAR_Downloader

PEAR_Downloader::$_config
PEAR_Downloader::$_downloadedPackages
PEAR_Downloader::$_errorStack
PEAR_Downloader::$_installed
PEAR_Downloader::$_options
PEAR_Downloader::$_preferredState
PEAR_Downloader::$_registry
PEAR_Downloader::$_remote
PEAR_Downloader::$_toDownload

Inherited from PEAR_Common

PEAR_Common::$config
PEAR_Common::$current_attributes
PEAR_Common::$current_element
PEAR_Common::$current_path
PEAR_Common::$element_stack
PEAR_Common::$pkginfo
PEAR_Common::$source_analyzer
PEAR_Common::$ui
PEAR_Common::$_validPackageFile
Methods
Constructor PEAR_Installer (line 109)

PEAR_Installer constructor.

  • access: public
PEAR_Installer PEAR_Installer (object &$ui)
  • object $ui: user interface object (instance of PEAR_Frontend_*)
addFileOperation (line 371)

Add a file operation to the current file transaction.

  • var: This can be one of:
    • rename: rename a file ($data has 2 values)
    • 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).
  • see: PEAR_Installer::startFileTransaction()
void addFileOperation (mixed $type, mixed $data)
checkDeps (line 951)

Check if the package meets all dependencies

  • return: False when no error occured, otherwise true
boolean checkDeps (array &$pkginfo, string &$errors)
  • array &$pkginfo: Package information (passed by reference)
  • string &$errors: Error message (passed by reference)
commitFileTransaction (line 400)
void commitFileTransaction ()
download (line 563)

Download any files and their dependencies, if necessary

  • deprecated: in favor of PEAR_Downloader
void download (array $packages, PEAR_Config $options, array &$config, array &$installpackages, array &$errors, [false $installed = false], [false $willinstall = false], [false $state = false])
  • 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

Redefinition of:
PEAR_Downloader::download()
Download any files and their dependencies, if necessary
install (line 597)

Installs the files within the package file specified.

  • return: package info if successful
array|PEAR_Error install (string $pkgfile, [mixed $options = array()], array $options )
  • string $pkgfile: path to the package file
  • 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
mkDirHier (line 534)
void mkDirHier (mixed $dir)

Redefinition of:
PEAR_Common::mkDirHier()
Wrapper to System::mkDir(), creates a directory as well as any necessary parent directories.
rollbackFileTransaction (line 489)
void rollbackFileTransaction ()
startFileTransaction (line 389)
void startFileTransaction ([mixed $rollback_in_case = false])
uninstall (line 876)

Uninstall a package

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

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

    Command-line options. Possibilities include:

    • installroot: base installation dir, if not the default
    • nodeps: do not process dependencies of other packages to ensure uninstallation does not break things

_buildCallback (line 1030)
void _buildCallback (mixed $what, mixed $data)
_deletePackageFiles (line 130)

Delete a package's installed files, does not remove empty directories.

  • return: TRUE on success, or a PEAR error on failure
  • access: private
bool _deletePackageFiles (string $package)
  • string $package: package name
_installFile (line 159)
  • access: private
void _installFile (string $file, array $atts, string $tmp_path, array $options)
  • string $file: filename
  • array $atts: attributes from <file> tag in package.xml
  • string $tmp_path: path to install the file in
  • array $options: options from command-line
_sortDirs (line 934)
void _sortDirs (mixed $a, mixed $b)

Inherited Methods

Inherited From PEAR_Downloader

 PEAR_Downloader::PEAR_Downloader()
 PEAR_Downloader::configSet()
 PEAR_Downloader::doDownload()
 PEAR_Downloader::download()
 PEAR_Downloader::extractDownloadFileName()
 PEAR_Downloader::getDownloadedPackages()
 PEAR_Downloader::getErrorMsgs()
 PEAR_Downloader::getPackageDownloadUrl()
 PEAR_Downloader::pushError()
 PEAR_Downloader::setOptions()
 PEAR_Downloader::_downloadCallback()
 PEAR_Downloader::_downloadFile()
 PEAR_Downloader::_downloadNonFile()
 PEAR_Downloader::_prependPath()
 PEAR_Downloader::_processDependency()

Inherited From PEAR_Common

 PEAR_Common::PEAR_Common()
 PEAR_Common::addTempFile()
 PEAR_Common::analyzeSourceCode()
 PEAR_Common::betterStates()
 PEAR_Common::buildProvidesArray()
 PEAR_Common::detectDependencies()
 PEAR_Common::downloadHttp()
 PEAR_Common::getDependencyRelations()
 PEAR_Common::getDependencyTypes()
 PEAR_Common::getFileRoles()
 PEAR_Common::getProvideTypes()
 PEAR_Common::getReleaseStates()
 PEAR_Common::getReplacementTypes()
 PEAR_Common::getScriptPhases()
 PEAR_Common::getUserRoles()
 PEAR_Common::infoFromAny()
 PEAR_Common::infoFromDescriptionFile()
 PEAR_Common::infoFromString()
 PEAR_Common::infoFromTgzFile()
 PEAR_Common::log()
 PEAR_Common::mkDirHier()
 PEAR_Common::mkTempDir()
 PEAR_Common::setFrontendObject()
 PEAR_Common::sortPkgDeps()
 PEAR_Common::validatePackageInfo()
 PEAR_Common::validPackageName()
 PEAR_Common::validPackageVersion()
 PEAR_Common::xmlFromInfo()
 PEAR_Common::_element_end()
 PEAR_Common::_element_end_1_0()
 PEAR_Common::_element_start()
 PEAR_Common::_element_start_1_0()
 PEAR_Common::_getPkgDeps()
 PEAR_Common::_getPkgDepTree()
 PEAR_Common::_getRevPkgDeps()
 PEAR_Common::_makeReleaseXml()
 PEAR_Common::_PEAR_Common()
 PEAR_Common::_pkginfo_cdata_1_0()
 PEAR_Common::_removedDependency()
 PEAR_Common::_sortPkgDeps()
 PEAR_Common::_sortPkgDepsRev()
 PEAR_Common::_unIndent()

Documentation generated on Fri, 3 Dec 2004 12:26:53 +0000 by phpDocumentor 1.3.0RC3