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
Afficher le fichier Open project: sourcefabric/newscoop Class Usage Examples

Méthodes publiques

Свойство 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

Méthodes publiques

Méthode 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 méthode

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

_buildCallback() public méthode

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

_compileSourceFiles() public méthode

public _compileSourceFiles ( $savechannel, &$filelist )

_deletePackageFiles() public méthode

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

_installFile() public méthode

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

_installFile2() public méthode

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

_parsePackageXml() public méthode

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

_removeBackups() public méthode

}}}
public _removeBackups ( $files )

_sortDirs() public méthode

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

_sortUninstall() public méthode

public _sortUninstall ( $a, $b )

addFileOperation() public méthode

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 méthode

{{{ commitFileTransaction()

download() public méthode

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 méthode

public getInstallPackages ( )

getUninstallPackages() public méthode

}}}

install() public méthode

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
Résultat array | PEAR_Error package info if successful

mkDirHier() public méthode

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

rollbackFileTransaction() public méthode

{{{ rollbackFileTransaction()

setConfig() public méthode

public setConfig ( &$config )

setDownloadedPackages() public méthode

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

setOptions() public méthode

public setOptions ( $options )

setUninstallPackages() public méthode

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

sortPackagesForUninstall() public méthode

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

startFileTransaction() public méthode

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

uninstall() public méthode

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
Résultat array

$debug public_oe property

debug level
public int $debug
Résultat integer

$docdir public_oe property

directory where documentation goes
public string $docdir
Résultat string

$extdir public_oe property

directory where PHP extension files go
public string $extdir
Résultat 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
Résultat array

$installroot public_oe property

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

$phpdir public_oe property

directory where PHP code files go
public string $phpdir
Résultat string

$pkgdir public_oe property

name of the package directory, for example Foo-1.0
public string $pkgdir
Résultat string

$registry public_oe property

PEAR_Registry object used by the installer
public PEAR_Registry $registry
Résultat PEAR_Registry

$tmpdir public_oe property

temporary directory
public string $tmpdir
Résultat string