Class PEAR_Registry

Description

Administration class used to maintain the installed package database.

Located in /maintenance/libraries/pear/PEAR/Registry.php (line 39)

PEAR
   |
   --PEAR_Registry
Variable Summary
 string $filemap
 string $lockfile
 resource $lock_fp
 string $statedir
Method Summary
 PEAR_Registry PEAR_Registry ([string $pear_install_dir = PEAR_INSTALL_DIR])
 void addPackage (mixed $package, mixed $info)
 string checkFileMap (string $path)
 void deletePackage (mixed $package)
 void listPackages ()
 void packageExists (mixed $package)
 void packageInfo ([mixed $package = null], [mixed $key = null])
 void readFileMap ()
 void rebuildFileMap ()
 void updatePackage (mixed $package, mixed $info, [mixed $merge = true])
 bool _assertStateDir ()
 void _closePackageFile (mixed $fp)
 void _listPackages ()
 bool _lock ([integer $mode = LOCK_EX])
 void _openPackageFile (mixed $package, mixed $mode)
 void _packageExists (mixed $package)
 string _packageFileName (string $package)
 void _packageInfo ([mixed $package = null], [mixed $key = null])
 void _PEAR_Registry ()
 void _unlock ()
Variables
string $filemap = '' (line 51)

File where the file map is stored

array $filemap_cache = array() (line 80)

Cache of file map. Structure:

array( '/path/to/file' => 'package', ... )

string $lockfile = '' (line 56)

Name of file used for locking the registry

resource $lock_fp = null (line 61)

File descriptor used during locking

int $lock_mode = 0 (line 66)

Mode used during locking

array $pkginfo_cache = array() (line 74)

Cache of package information. Structure:

array( 'package' => array('id' => ... ), ... )

string $statedir = '' (line 46)

Directory where registry files are stored.

Methods
Constructor PEAR_Registry (line 93)

PEAR_Registry constructor.

  • access: public
PEAR_Registry PEAR_Registry ([string $pear_install_dir = PEAR_INSTALL_DIR])
  • string $pear_install_dir: (optional) PEAR install directory (for .php files)
addPackage (line 422)
void addPackage (mixed $package, mixed $info)
checkFileMap (line 502)

Test whether a file belongs to a package.

  • return: which package the file belongs to, or an empty string if the file does not belong to an installed package
  • access: public
string checkFileMap (string $path)
  • string $path: file path, absolute or relative to the pear install dir
deletePackage (line 445)
void deletePackage (mixed $package)
listPackages (line 409)
void listPackages ()
packageExists (line 383)
void packageExists (mixed $package)
packageInfo (line 396)
void packageInfo ([mixed $package = null], [mixed $key = null])
readFileMap (line 235)
void readFileMap ()
rebuildFileMap (line 198)
void rebuildFileMap ()
updatePackage (line 460)
void updatePackage (mixed $package, mixed $info, [mixed $merge = true])
_assertStateDir (line 146)

Make sure the directory where we keep registry files exists.

  • return: TRUE if directory exists, FALSE if it could not be created
  • access: private
bool _assertStateDir ()
_closePackageFile (line 190)
void _closePackageFile (mixed $fp)
_listPackages (line 363)
void _listPackages ()
_lock (line 270)

Lock the registry.

  • return: TRUE on success, FALSE if locking failed, or a PEAR error if some other error occurs (such as the lock file not being writable).
  • access: private
bool _lock ([integer $mode = LOCK_EX])
  • integer $mode: lock mode, one of LOCK_EX, LOCK_SH or LOCK_UN. See flock manual for more information.
_openPackageFile (line 176)
void _openPackageFile (mixed $package, mixed $mode)
_packageExists (line 327)
void _packageExists (mixed $package)
_packageFileName (line 168)

Get the name of the file where data for a given package is stored.

  • return: registry file name
  • access: public
string _packageFileName (string $package)
  • string $package: package name
_packageInfo (line 335)
void _packageInfo ([mixed $package = null], [mixed $key = null])
_PEAR_Registry (line 126)

PEAR_Registry destructor. Makes sure no locks are forgotten.

  • access: private
void _PEAR_Registry ()
_unlock (line 314)
void _unlock ()

Documentation generated on Fri, 11 Feb 2005 18:13:56 +0000 by phpDocumentor 1.3.0RC3