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

Class: PEAR_Common

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

Class Overview

PEAR
   |
   --PEAR_Common

Class providing common functionality for PEAR administration classes.


Author(s):

Version:

  • Release: 1.9.4

Copyright:

  • 1997-2009 The Authors

Variables

Methods


Child classes:

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

Inherited Variables

Inherited Methods

Class: PEAR

PEAR::PEAR()
Constructor. Registers this object in $_PEAR_destructor_object_list for destructor emulation if a destructor object exists.
PEAR::delExpect()
This method deletes all occurences 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::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 independant PHP extension load. Remember to take care on the correct extension name for case sensitive OSes.
PEAR::popErrorHandling()
Pop the last error handler used
PEAR::popExpect()
This method pops one element off the expected error codes stack.
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::registerShutdownFunc()
Use this function to register a shutdown method for static classes.
PEAR::setErrorHandling()
Sets how errors generated by this object should be handled.
PEAR::staticPopErrorHandling()
PEAR::staticPushErrorHandling()
PEAR::throwError()
Simpler form of raiseError with fewer options. In most cases message, code and userinfo are enough.
PEAR::_PEAR()
Destructor (the emulated type of...). Does nothing right now, but is included for forward compatibility, so subclass destructors should always call it.

Class Details

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


[ Top ]


Class Variables

$config =  null

[line 140]

Configuration object (PEAR_Config).

Type:   PEAR_Config


[ Top ]

$current_attributes = array()

[line 149]

array of attributes of the currently parsed XML element

Type:   mixed


[ Top ]

$current_element =

[line 146]

name of currently parsed XML element

Type:   mixed


[ Top ]

$current_path =  null

[line 154]


Type:   mixed


[ Top ]

$element_stack = array()

[line 143]

stack of elements, gives some sort of XML context

Type:   mixed


[ Top ]

$pkginfo = array()

[line 152]

assoc with information about a package

Type:   mixed


[ Top ]

$ui =  null

[line 134]

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

Type:   object


[ Top ]



Method Detail

PEAR_Common (Constructor)   [line 168]

PEAR_Common PEAR_Common( )

PEAR_Common constructor
  • Access: public

[ Top ]

addTempFile   [line 209]

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 734]

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 311]

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 675]

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 744]

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


Parameters:

   $any     
   $status_callback     

[ Top ]

downloadHttp   [line 827]

string downloadHttp( string $url, &$ui, [string $save_dir = '.'], [mixed $callback = null], 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().
  • Deprecated: in favor of PEAR_Downloader::downloadHttp()
  • Access: public

Overridden in child classes as:

PEAR_Downloader::downloadHttp()
Download a file through HTTP. Considers suggested file name in

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
   &$ui     

[ Top ]

getDependencyRelations   [line 363]

array getDependencyRelations( )

Get the implemented dependency relations (has, lt, ge etc.)

[ Top ]

getDependencyTypes   [line 352]

array getDependencyTypes( )

Get the implemented dependency types (php, ext, pkg etc.)

[ Top ]

getFileRoles   [line 374]

array getFileRoles( )

Get the implemented file roles

[ Top ]

getProvideTypes   [line 396]

array getProvideTypes( )

Get the implemented file replacement types in

[ Top ]

getReleaseStates   [line 341]

array getReleaseStates( )

Get the valid package release states of packages

[ Top ]

getReplacementTypes   [line 385]

array getReplacementTypes( )

Get the implemented file replacement types in

[ Top ]

getScriptPhases   [line 407]

array getScriptPhases( )

Get the implemented file replacement types in

[ Top ]

getUserRoles   [line 330]

array getUserRoles( )

Get the valid roles for a PEAR package maintainer

[ Top ]

infoFromAny   [line 571]

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 509]

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 528]

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 490]

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 445]

boolean isIncludeable( string $path)


Parameters:

string   $path     relative or absolute include path

[ Top ]

log   [line 248]

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 227]

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 275]

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 298]

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 626]

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 421]

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 435]

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 604]

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 Wed, 06 Jul 2011 23:30:34 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.