registry = new PEAR_Registry; } /** * Returns the version string for the installed eZ Components bundle. * * A version string such as "2008.2.2" is returned. * * @return string */ public function getBundleVersion() { @$packageInfo = $this->registry->packageInfo( 'ezcomponents', null, 'components.ez.no' ); return $packageInfo['version']['release']; } /** * Returns a PHP version string that describes the required PHP version for * this installed eZ Components bundle. * * @return string */ public function getRequiredPhpVersion() { @$packageInfo = $this->registry->packageInfo( 'ezcomponents', null, 'components.ez.no' ); if ( array_key_exists( 'required', $packageInfo['dependencies'] ) ) { return $packageInfo['dependencies']['required']['php']['min']; } return $packageInfo['dependencies']['php']['min']; } /** * Returns whether $componentName is installed * * Checks the PEAR registry whether the component is there. * * @return bool */ public function isComponentInstalled( $componentName ) { @$packageInfo = $this->registry->packageInfo( $componentName, null, 'components.ez.no' ); return is_array( $packageInfo ); } /** * Returns the version string of the available $componentName or false when * the component is not installed. * * @return string */ public function getComponentVersion( $componentName ) { @$packageInfo = $this->registry->packageInfo( $componentName, null, 'components.ez.no' ); $release = $packageInfo['version']['release']; return $release === null ? false : $release; } /** * Returns a list of components that $componentName depends on. * * If $componentName is left empty, all installed components are returned. * * The returned array has as keys the component names, and as values the * version of the components. * * @return array(string=>string). */ public function getComponentDependencies( $componentName = 'ezcomponents' ) { @$packageInfo = $this->registry->packageInfo( $componentName, 'dependencies', 'components.ez.no' ); if ( isset( $packageInfo['required']['package'] ) ) { $deps = array(); if ( isset( $packageInfo['required']['package']['name'] ) ) { $deps[$packageInfo['required']['package']['name']] = $packageInfo['required']['package']['min']; } else { foreach ( $packageInfo['required']['package'] as $package ) { $deps[$package['name']] = $package['min']; } } return $deps; } return array(); } } ?>