PHP Класс 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..
Автор: Stig Bakken ([email protected])
Автор: Martin Jansen ([email protected])
Автор: Greg Beaver ([email protected])
Наследование: extends PEAR_Downloader
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$_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

Открытые методы

Метод Описание
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

Описание методов

PEAR_Installer() публичный Метод

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

_buildCallback() публичный Метод

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

_compileSourceFiles() публичный Метод

public _compileSourceFiles ( $savechannel, &$filelist )

_deletePackageFiles() публичный Метод

Delete a package's installed files, does not remove empty directories.
public _deletePackageFiles ( $package, $channel = false, $backup = false ) : boolean
Результат boolean TRUE on success, or a PEAR error on failure

_installFile() публичный Метод

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

_installFile2() публичный Метод

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

_parsePackageXml() публичный Метод

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

_removeBackups() публичный Метод

}}}
public _removeBackups ( $files )

_sortDirs() публичный Метод

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

_sortUninstall() публичный Метод

public _sortUninstall ( $a, $b )

addFileOperation() публичный Метод

Add a file operation to the current file transaction.
См. также: 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() публичный Метод

{{{ commitFileTransaction()

download() публичный Метод

Download any files and their dependencies, if necessary
Устаревший: in favor of PEAR_Downloader
public download ( $packages, $options, &$config, &$installpackages, &$errors, $installed = false, $willinstall = false, $state = false )

getInstallPackages() публичный Метод

public getInstallPackages ( )

getUninstallPackages() публичный Метод

}}}

install() публичный Метод

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
Результат array | PEAR_Error package info if successful

mkDirHier() публичный Метод

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

rollbackFileTransaction() публичный Метод

{{{ rollbackFileTransaction()

setConfig() публичный Метод

public setConfig ( &$config )

setDownloadedPackages() публичный Метод

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

setOptions() публичный Метод

public setOptions ( $options )

setUninstallPackages() публичный Метод

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

sortPackagesForUninstall() публичный Метод

It also removes duplicate dependencies
public sortPackagesForUninstall ( &$packages ) : array | PEAR_Error
Результат array | PEAR_Error array of array(packagefilename, package.xml contents)

startFileTransaction() публичный Метод

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

uninstall() публичный Метод

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

Описание свойств

$_downloadedPackages публичное свойство

array of PEAR_Downloader_Packages
public array $_downloadedPackages
Результат array

$debug публичное свойство

debug level
public int $debug
Результат integer

$docdir публичное свойство

directory where documentation goes
public string $docdir
Результат string

$extdir публичное свойство

directory where PHP extension files go
public string $extdir
Результат string

$file_operations публичное свойство

Format: array( 0 => array("rename => array("from-file", "to-file")), 1 => array("delete" => array("file-to-delete")), ... )
public array $file_operations
Результат array

$installroot публичное свойство

installation root directory (ala PHP's INSTALL_ROOT or automake's DESTDIR
public string $installroot
Результат string

$phpdir публичное свойство

directory where PHP code files go
public string $phpdir
Результат string

$pkgdir публичное свойство

name of the package directory, for example Foo-1.0
public string $pkgdir
Результат string

$registry публичное свойство

PEAR_Registry object used by the installer
public PEAR_Registry $registry
Результат PEAR_Registry

$tmpdir публичное свойство

temporary directory
public string $tmpdir
Результат string