PHP Class PEAR_Installer

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..
Author: Stig Bakken ([email protected])
Author: Martin Jansen ([email protected])
Author: Greg Beaver ([email protected])
Inheritance: extends PEAR_Downloader
Exibir arquivo Open project: sourcefabric/newscoop Class Usage Examples

Public Properties

Property Type Description
$_downloadedPackages array array of PEAR_Downloader_Packages
$debug integer debug level
$docdir string directory where documentation goes
$extdir string directory where PHP extension files go
$file_operations array Format: array( 0 => array("rename => array("from-file", "to-file")), 1 => array("delete" => array("file-to-delete")), ... )
$installroot string installation root directory (ala PHP's INSTALL_ROOT or automake's DESTDIR
$phpdir string directory where PHP code files go
$pkgdir string name of the package directory, for example Foo-1.0
$registry PEAR_Registry PEAR_Registry object used by the installer
$tmpdir string temporary directory

Public Methods

Method Description
PEAR_Installer ( object &$ui ) PEAR_Installer constructor.
_buildCallback ( $what, $data ) {{{ _buildCallback()
_compileSourceFiles ( $savechannel, &$filelist )
_deletePackageFiles ( $package, $channel = false, $backup = false ) : boolean Delete a package's installed files, does not remove empty directories.
_installFile ( $file, $atts, $tmp_path, $options )
_installFile2 ( &$pkg, $file, &$real_atts, $tmp_path, $options )
_parsePackageXml ( &$descfile ) {{{ _parsePackageXml()
_removeBackups ( $files ) }}}
_sortDirs ( $a, $b ) {{{ _sortDirs()
_sortUninstall ( $a, $b )
addFileOperation ( string $type, array $data ) Add a file operation to the current file transaction.
commitFileTransaction ( ) {{{ commitFileTransaction()
download ( $packages, $options, &$config, &$installpackages, &$errors, $installed = false, $willinstall = false, $state = false ) Download any files and their dependencies, if necessary
getInstallPackages ( )
getUninstallPackages ( ) }}}
install ( string | PEAR_Downloader_Package $pkgfile, array $options = [] ) : array | PEAR_Error Installs the files within the package file specified.
mkDirHier ( $dir ) {{{ mkDirHier($dir)
rollbackFileTransaction ( ) {{{ rollbackFileTransaction()
setConfig ( &$config )
setDownloadedPackages ( &$pkgs ) Set the list of PEAR_Downloader_Package objects to allow more sane dependency validation
setOptions ( $options )
setUninstallPackages ( &$pkgs ) Set the list of PEAR_Downloader_Package objects to allow more sane dependency validation
sortPackagesForUninstall ( &$packages ) : array | PEAR_Error Sort a list of arrays of array(downloaded packagefilename) by dependency.
startFileTransaction ( $rollback_in_case = false ) {{{ startFileTransaction()
uninstall ( $package, $options = [] ) Uninstall a package

Method Details

PEAR_Installer() public method

PEAR_Installer constructor.
public PEAR_Installer ( object &$ui )
$ui object user interface object (instance of PEAR_Frontend_*)

_buildCallback() public method

{{{ _buildCallback()
public _buildCallback ( $what, $data )

_compileSourceFiles() public method

public _compileSourceFiles ( $savechannel, &$filelist )

_deletePackageFiles() public method

Delete a package's installed files, does not remove empty directories.
public _deletePackageFiles ( $package, $channel = false, $backup = false ) : boolean
return boolean TRUE on success, or a PEAR error on failure

_installFile() public method

public _installFile ( $file, $atts, $tmp_path, $options )

_installFile2() public method

public _installFile2 ( &$pkg, $file, &$real_atts, $tmp_path, $options )

_parsePackageXml() public method

{{{ _parsePackageXml()
public _parsePackageXml ( &$descfile )

_removeBackups() public method

}}}
public _removeBackups ( $files )

_sortDirs() public method

{{{ _sortDirs()
public _sortDirs ( $a, $b )

_sortUninstall() public method

public _sortUninstall ( $a, $b )

addFileOperation() public method

Add a file operation to the current file transaction.
See also: startFileTransaction()
public addFileOperation ( string $type, array $data )
$type string 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).
$data array 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

commitFileTransaction() public method

{{{ commitFileTransaction()

download() public method

Download any files and their dependencies, if necessary
Deprecation: in favor of PEAR_Downloader
public download ( $packages, $options, &$config, &$installpackages, &$errors, $installed = false, $willinstall = false, $state = false )

getInstallPackages() public method

public getInstallPackages ( )

getUninstallPackages() public method

}}}

install() public method

Installs the files within the package file specified.
public install ( string | PEAR_Downloader_Package $pkgfile, array $options = [] ) : array | PEAR_Error
$pkgfile string | PEAR_Downloader_Package path to the package file, or a pre-initialized packagefile object
$options array 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
return array | PEAR_Error package info if successful

mkDirHier() public method

{{{ mkDirHier($dir)
public mkDirHier ( $dir )

rollbackFileTransaction() public method

{{{ rollbackFileTransaction()

setConfig() public method

public setConfig ( &$config )

setDownloadedPackages() public method

Set the list of PEAR_Downloader_Package objects to allow more sane dependency validation
public setDownloadedPackages ( &$pkgs )

setOptions() public method

public setOptions ( $options )

setUninstallPackages() public method

Set the list of PEAR_Downloader_Package objects to allow more sane dependency validation
public setUninstallPackages ( &$pkgs )

sortPackagesForUninstall() public method

It also removes duplicate dependencies
public sortPackagesForUninstall ( &$packages ) : array | PEAR_Error
return array | PEAR_Error array of array(packagefilename, package.xml contents)

startFileTransaction() public method

{{{ startFileTransaction()
public startFileTransaction ( $rollback_in_case = false )

uninstall() public method

This method removes all files installed by the application, and then removes any empty directories.
public uninstall ( $package, $options = [] )

Property Details

$_downloadedPackages public_oe property

array of PEAR_Downloader_Packages
public array $_downloadedPackages
return array

$debug public_oe property

debug level
public int $debug
return integer

$docdir public_oe property

directory where documentation goes
public string $docdir
return string

$extdir public_oe property

directory where PHP extension files go
public string $extdir
return string

$file_operations public_oe property

Format: array( 0 => array("rename => array("from-file", "to-file")), 1 => array("delete" => array("file-to-delete")), ... )
public array $file_operations
return array

$installroot public_oe property

installation root directory (ala PHP's INSTALL_ROOT or automake's DESTDIR
public string $installroot
return string

$phpdir public_oe property

directory where PHP code files go
public string $phpdir
return string

$pkgdir public_oe property

name of the package directory, for example Foo-1.0
public string $pkgdir
return string

$registry public_oe property

PEAR_Registry object used by the installer
public PEAR_Registry $registry
return PEAR_Registry

$tmpdir public_oe property

temporary directory
public string $tmpdir
return string