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

Class: PEAR_Common

Source Location: /PEAR-1.10.12/PEAR/Common.php

Class Overview

PEAR
   |
   --PEAR_Common

Class providing common functionality for PEAR administration classes.


Author(s):

Version:

  • Release: 1.10.12

Copyright:

  • 1997-2009 The Authors

Variables

Methods


Child classes:

PEAR_Downloader
Administration class used to download anything from the internet (PEAR Packages, static URLs, xml files)
PEAR_Builder
Class to handle building (compiling) extensions.
PEAR_Packager
Administration class used to make a PEAR release tarball.

Inherited Variables

Inherited Methods

Class: PEAR

PEAR::__construct()
Constructor. Registers this object in $_PEAR_destructor_object_list for destructor emulation if a destructor object exists.
PEAR::PEAR()
Only here for backwards compatibility.
PEAR::delExpect()
This method deletes all occurrences 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::getSourceDateEpoch()
Get SOURCE_DATE_EPOCH environment variable See https://reproducible-builds.org/specs/source-date-epoch/
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 independent PHP extension load. Remember to take care on the correct extension name for case sensitive OSes.
PEAR::popExpect()
This method pops one element off the expected error codes stack.
PEAR::registerShutdownFunc()
Use this function to register a shutdown method for static classes.
PEAR::staticPopErrorHandling()
PEAR::staticPushErrorHandling()
PEAR::_PEAR()
Destructor (the emulated type of...). Does nothing right now, but is included for forward compatibility, so subclass destructors should always call it.
PEAR::_popErrorHandling()
Pop the last error handler used
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::_setErrorHandling()
Sets how errors generated by this object should be handled.
PEAR::_throwError()
Simpler form of raiseError with fewer options. In most cases message, code and userinfo are enough.
PEAR::__call()
PEAR::__callStatic()

Class Details

[line 126]
Class providing common functionality for PEAR administration classes.


[ Top ]


Class Variables

$config =  null

[line 139]

Configuration object (PEAR_Config).

Type:   PEAR_Config


[ Top ]

$current_attributes = array()

[line 148]

array of attributes of the currently parsed XML element

Type:   mixed


[ Top ]

$current_element =

[line 145]

name of currently parsed XML element

Type:   mixed


[ Top ]

$current_path =  null

[line 153]


Type:   mixed


[ Top ]

$element_stack = array()

[line 142]

stack of elements, gives some sort of XML context

Type:   mixed


[ Top ]

$pkginfo = array()

[line 151]

assoc with information about a package

Type:   mixed


[ Top ]

$ui =  null

[line 133]

User Interface object (PEAR_Frontend_* class). If null, the log() method uses print.

Type:   object


[ Top ]



Method Detail

__construct (Constructor)   [line 167]

PEAR_Common __construct( )

PEAR_Common constructor
  • Access: public

Overridden in child classes as:

PEAR_Downloader::__construct()
PEAR_Installer::__construct()
PEAR_Installer constructor.
PEAR_Builder::__construct()
PEAR_Builder constructor.

Overrides PEAR::__construct() (Constructor. Registers this object in $_PEAR_destructor_object_list for destructor emulation if a destructor object exists.)
[ Top ]

addTempFile   [line 208]

void addTempFile( string $file)

Register a temporary file or directory. When the destructor is executed, all registered temporary files and directories are removed.
  • Access: public

Parameters:

string   $file   —  name of file or directory

[ Top ]

analyzeSourceCode   [line 721]

mixed analyzeSourceCode( string $file)

Analyze the source code of the given PHP file
  • Access: public

Parameters:

string   $file   —  Filename of the PHP file

[ Top ]

betterStates   [line 307]

false|array betterStates( string $state, [boolean $include = false])

Return an array containing all of the states that are more stable than or equal to the passed in state
  • Return: False if $state is not a valid release state

Parameters:

string   $state   —  Release state
boolean   $include   —  Determines whether to include $state in the list

[ Top ]

buildProvidesArray   [line 662]

void buildProvidesArray( array $srcinfo)

Build a "provides" array from data returned by analyzeSourceCode(). The format of the built array is like this:

array( 'class;MyClass' => 'array('type' => 'class', 'name' => 'MyClass'), ... )

  • Access: public

Parameters:

array   $srcinfo   —  array with information about a source file as returned by the analyzeSourceCode() method.

[ Top ]

detectDependencies   [line 731]

void detectDependencies( $any, [ $status_callback = null])


Parameters:

   $any   — 
   $status_callback   — 

[ Top ]

downloadHttp   [line 823]

mixed downloadHttp( string $url, &$ui, [string $save_dir = '.'], [mixed $callback = null], [false|string|array $lastmodified = null], [false|array $accept = false], [false|string $channel = false], object $ui, object $config)

Download a file through HTTP. Considers suggested file name in

Content-disposition: header and can run a callback function for different events. The callback will be called with two parameters: the callback type, and parameters. The implemented callback types are:

'setup' called at the very beginning, parameter is a UI object that should be used for all output 'message' the parameter is a string with an informational message 'saveas' may be used to save with a different file name, the parameter is the filename that is about to be used. If a 'saveas' callback returns a non-empty string, that file name will be used as the filename instead. Note that $save_dir will not be affected by this, only the basename of the file. 'start' download is starting, parameter is number of bytes that are expected, or -1 if unknown 'bytesread' parameter is the number of bytes read so far 'done' download is complete, parameter is the total number of bytes read 'connfailed' if the TCP connection fails, this callback is called with array(host,port,errno,errmsg) 'writefailed' if writing to disk fails, this callback is called with array(destfile,errmsg)

If an HTTP proxy has been configured (http_proxy PEAR_Config setting), the proxy will be used.

  • Return: Returns the full path of the downloaded file or a PEAR error on failure. If the error is caused by socket-related errors, the error object will have the fsockopen error code available through getCode(). If caching is requested, then return the header values. If $lastmodified was given and the there are no changes, boolean false is returned.
  • Access: public

Parameters:

string   $url   —  the URL to download
object   $ui   —  PEAR_Frontend_* instance
object   $config   —  PEAR_Config instance
string   $save_dir   —  (optional) directory to save file in
mixed   $callback   —  (optional) function/method to call for status updates
false|string|array   $lastmodified   —  header values to check against for caching use false to return the header values from this download
false|array   $accept   —  Accept headers to send
false|string   $channel   —  Channel to use for retrieving authentication
   &$ui   — 

[ Top ]

getDependencyRelations   [line 355]

array getDependencyRelations( )

Get the implemented dependency relations (has, lt, ge etc.)
  • Access: public

[ Top ]

getDependencyTypes   [line 345]

array getDependencyTypes( )

Get the implemented dependency types (php, ext, pkg etc.)
  • Access: public

[ Top ]

getFileRoles   [line 365]

array getFileRoles( )

Get the implemented file roles
  • Access: public

[ Top ]

getProvideTypes   [line 385]

array getProvideTypes( )

Get the implemented file replacement types in
  • Access: public

[ Top ]

getReleaseStates   [line 335]

array getReleaseStates( )

Get the valid package release states of packages
  • Access: public

[ Top ]

getReplacementTypes   [line 375]

array getReplacementTypes( )

Get the implemented file replacement types in
  • Access: public

[ Top ]

getScriptPhases   [line 395]

array getScriptPhases( )

Get the implemented file replacement types in
  • Access: public

[ Top ]

getUserRoles   [line 325]

array getUserRoles( )

Get the valid roles for a PEAR package maintainer
  • Access: public

[ Top ]

infoFromAny   [line 558]

string infoFromAny( string $info)

Returns package information from different sources

This method is able to extract information about a package from a .tgz archive or from a XML package definition file.

  • Deprecated: use PEAR_PackageFile->fromAnyFile() instead
  • Access: public

Parameters:

string   $info   —  Filename of the source ('package.xml', '<package>.tgz')

[ Top ]

infoFromDescriptionFile   [line 496]

array infoFromDescriptionFile( string $descfile)

Returns information about a package file. Expects the name of a package xml file as input.
  • Return: array with package information
  • Deprecated: use PEAR_PackageFile->fromPackageFile() instead
  • Access: public

Parameters:

string   $descfile   —  name of package xml file

[ Top ]

infoFromString   [line 515]

array infoFromString( string $data)

Returns information about a package file. Expects the contents of a package xml file as input.
  • Return: array with package information
  • Deprecated: use PEAR_PackageFile->fromXmlstring() instead
  • Access: public

Parameters:

string   $data   —  contents of package.xml file

[ Top ]

infoFromTgzFile   [line 477]

array infoFromTgzFile( string $file)

Returns information about a package file. Expects the name of a gzipped tar file as input.
  • Return: array with package information
  • Deprecated: use PEAR_PackageFile->fromTgzFile() instead
  • Access: public

Parameters:

string   $file   —  name of .tgz file

[ Top ]

isIncludeable   [line 432]

boolean isIncludeable( string $path)

  • Access: public

Parameters:

string   $path   —  relative or absolute include path

[ Top ]

log   [line 244]

void log( int $level, string $msg, [ $append_crlf = true])

Logging method.
  • Access: public

Overridden in child classes as:

PEAR_Builder::log()

Parameters:

int   $level   —  log level (0 is quiet, higher is noisier)
string   $msg   —  message to write to the log
   $append_crlf   — 

[ Top ]

mkDirHier   [line 226]

bool mkDirHier( string $dir)

Wrapper to System::mkDir(), creates a directory as well as any necessary parent directories.
  • Return: TRUE on success, or a PEAR error
  • Access: public

Overridden in child classes as:

PEAR_Installer::mkDirHier()

Parameters:

string   $dir   —  directory name

[ Top ]

mkTempDir   [line 271]

string mkTempDir( [string $tmpdir = ''])

Create and register a temporary directory.
  • Return: name of created directory
  • Access: public

Parameters:

string   $tmpdir   —  (optional) Directory to use as tmpdir. Will use system defaults (for example /tmp or c:\windows\temp) if not specified

[ Top ]

setFrontendObject   [line 294]

void setFrontendObject( object Reference &$ui)

Set object that represents the frontend to be used.
  • Access: public

Parameters:

object Reference   &$ui   —  of the frontend object

[ Top ]

validatePackageInfo   [line 613]

boolean validatePackageInfo( string $info, &$errors, &$warnings, [string $dir_prefix = ''], array $errors, array $warnings)

Validate XML package definition file.
  • Deprecated: use the validation of PEAR_PackageFile objects
  • Access: public

Parameters:

string   $info   —  Filename of the package archive or of the package definition file
array   $errors   —  Array that will contain the errors
array   $warnings   —  Array that will contain the warnings
string   $dir_prefix   —  (optional) directory where source files may be found, or empty if they are not available
   &$errors   — 
   &$warnings   — 

[ Top ]

validPackageName   [line 409]

bool validPackageName( string $name)

Test whether a string contains a valid package name.
  • Access: public

Parameters:

string   $name   —  the package name to test

[ Top ]

validPackageVersion   [line 423]

bool validPackageVersion( string $ver)

Test whether a string contains a valid package version.
  • Access: public

Parameters:

string   $ver   —  the package version to test

[ Top ]

xmlFromInfo   [line 591]

string xmlFromInfo( array $pkginfo)

Return an XML document based on the package info (as returned by the PEAR_Common::infoFrom* methods).
  • Return: XML data
  • Deprecated: use a PEAR_PackageFile_v* object's generator instead
  • Access: public

Parameters:

array   $pkginfo   —  package info

[ Top ]


Documentation generated on Sun, 19 Apr 2020 14:22:12 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.