* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Common.php 313023 2011-07-06 19:17:11Z dufuz $
* @link http://pear.php.net/package/PEAR
* @since File available since Release 0.1.0
* @deprecated File deprecated since Release 1.4.0a1
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
+ * @version Release: 1.10.1
* @link http://pear.php.net/package/PEAR
* @since Class available since Release 1.4.0a1
* @deprecated This class will disappear, and its components will be spread
*
* @access public
*/
- function PEAR_Common()
+ function __construct()
{
- parent::PEAR();
+ parent::__construct();
$this->config = &PEAR_Config::singleton();
$this->debug = $this->config->get('verbose');
}
* @param string $msg message to write to the log
*
* @return void
- *
- * @access public
- * @static
*/
- function log($level, $msg, $append_crlf = true)
+ public function log($level, $msg, $append_crlf = true)
{
if ($this->debug >= $level) {
if (!class_exists('PEAR_Frontend')) {
* Get the valid roles for a PEAR package maintainer
*
* @return array
- * @static
*/
- function getUserRoles()
+ public static function getUserRoles()
{
return $GLOBALS['_PEAR_Common_maintainer_roles'];
}
* Get the valid package release states of packages
*
* @return array
- * @static
*/
- function getReleaseStates()
+ public static function getReleaseStates()
{
return $GLOBALS['_PEAR_Common_release_states'];
}
* Get the implemented dependency types (php, ext, pkg etc.)
*
* @return array
- * @static
*/
- function getDependencyTypes()
+ public static function getDependencyTypes()
{
return $GLOBALS['_PEAR_Common_dependency_types'];
}
* Get the implemented dependency relations (has, lt, ge etc.)
*
* @return array
- * @static
*/
- function getDependencyRelations()
+ public static function getDependencyRelations()
{
return $GLOBALS['_PEAR_Common_dependency_relations'];
}
* Get the implemented file roles
*
* @return array
- * @static
*/
- function getFileRoles()
+ public static function getFileRoles()
{
return $GLOBALS['_PEAR_Common_file_roles'];
}
* Get the implemented file replacement types in
*
* @return array
- * @static
*/
- function getReplacementTypes()
+ public static function getReplacementTypes()
{
return $GLOBALS['_PEAR_Common_replacement_types'];
}
* Get the implemented file replacement types in
*
* @return array
- * @static
*/
- function getProvideTypes()
+ public static function getProvideTypes()
{
return $GLOBALS['_PEAR_Common_provide_types'];
}
* Get the implemented file replacement types in
*
* @return array
- * @static
*/
- function getScriptPhases()
+ public static function getScriptPhases()
{
return $GLOBALS['_PEAR_Common_script_phases'];
}
/**
* @param string $path relative or absolute include path
* @return boolean
- * @static
*/
- function isIncludeable($path)
+ public static function isIncludeable($path)
{
if (file_exists($path) && is_readable($path)) {
return true;
*/
function infoFromTgzFile($file)
{
- $packagefile = &new PEAR_PackageFile($this->config);
+ $packagefile = new PEAR_PackageFile($this->config);
$pf = &$packagefile->fromTgzFile($file, PEAR_VALIDATE_NORMAL);
return $this->_postProcessChecks($pf);
}
*/
function infoFromDescriptionFile($descfile)
{
- $packagefile = &new PEAR_PackageFile($this->config);
+ $packagefile = new PEAR_PackageFile($this->config);
$pf = &$packagefile->fromPackageFile($descfile, PEAR_VALIDATE_NORMAL);
return $this->_postProcessChecks($pf);
}
*/
function infoFromString($data)
{
- $packagefile = &new PEAR_PackageFile($this->config);
+ $packagefile = new PEAR_PackageFile($this->config);
$pf = &$packagefile->fromXmlString($data, PEAR_VALIDATE_NORMAL, false);
return $this->_postProcessChecks($pf);
}
function infoFromAny($info)
{
if (is_string($info) && file_exists($info)) {
- $packagefile = &new PEAR_PackageFile($this->config);
+ $packagefile = new PEAR_PackageFile($this->config);
$pf = &$packagefile->fromAnyFile($info, PEAR_VALIDATE_NORMAL);
if (PEAR::isError($pf)) {
$errs = $pf->getUserinfo();
function xmlFromInfo($pkginfo)
{
$config = &PEAR_Config::singleton();
- $packagefile = &new PEAR_PackageFile($config);
+ $packagefile = new PEAR_PackageFile($config);
$pf = &$packagefile->fromArray($pkginfo);
$gen = &$pf->getDefaultGenerator();
return $gen->toXml(PEAR_VALIDATE_PACKAGING);
function validatePackageInfo($info, &$errors, &$warnings, $dir_prefix = '')
{
$config = &PEAR_Config::singleton();
- $packagefile = &new PEAR_PackageFile($config);
+ $packagefile = new PEAR_PackageFile($config);
PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
if (strpos($info, '<?xml') !== false) {
$pf = &$packagefile->fromXmlString($info, PEAR_VALIDATE_NORMAL, '');
* @param string $save_dir (optional) directory to save file in
* @param mixed $callback (optional) function/method to call for status
* updates
- *
- * @return string 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().
+ * @param false|string|array $lastmodified header values to check against
+ * for caching
+ * use false to return the header
+ * values from this download
+ * @param false|array $accept Accept headers to send
+ * @param false|string $channel Channel to use for retrieving
+ * authentication
+ *
+ * @return mixed 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
- * @deprecated in favor of PEAR_Downloader::downloadHttp()
*/
- function downloadHttp($url, &$ui, $save_dir = '.', $callback = null)
- {
+ function downloadHttp(
+ $url, &$ui, $save_dir = '.', $callback = null, $lastmodified = null,
+ $accept = false, $channel = false
+ ) {
if (!class_exists('PEAR_Downloader')) {
require_once 'PEAR/Downloader.php';
}
- return PEAR_Downloader::downloadHttp($url, $ui, $save_dir, $callback);
+ return PEAR_Downloader::_downloadHttp(
+ $this, $url, $ui, $save_dir, $callback, $lastmodified,
+ $accept, $channel
+ );
}
}
require_once 'PEAR/Config.php';
-require_once 'PEAR/PackageFile.php';
\ No newline at end of file
+require_once 'PEAR/PackageFile.php';