Updated PEAR and PEAR packages.
[timetracker.git] / WEB-INF / lib / pear / PEAR / Common.php
index 3a8c7e8..5fe76ad 100644 (file)
@@ -11,7 +11,6 @@
  * @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
@@ -118,7 +117,7 @@ $GLOBALS['_PEAR_Common_script_phases'] = array('pre-install', 'post-install', 'p
  * @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
@@ -165,9 +164,9 @@ class PEAR_Common extends PEAR
      *
      * @access public
      */
-    function PEAR_Common()
+    function __construct()
     {
-        parent::PEAR();
+        parent::__construct();
         $this->config = &PEAR_Config::singleton();
         $this->debug = $this->config->get('verbose');
     }
@@ -241,11 +240,8 @@ class PEAR_Common extends PEAR
      * @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')) {
@@ -325,9 +321,8 @@ class PEAR_Common extends PEAR
      * Get the valid roles for a PEAR package maintainer
      *
      * @return array
-     * @static
      */
-    function getUserRoles()
+    public static function getUserRoles()
     {
         return $GLOBALS['_PEAR_Common_maintainer_roles'];
     }
@@ -336,9 +331,8 @@ class PEAR_Common extends PEAR
      * Get the valid package release states of packages
      *
      * @return array
-     * @static
      */
-    function getReleaseStates()
+    public static function getReleaseStates()
     {
         return $GLOBALS['_PEAR_Common_release_states'];
     }
@@ -347,9 +341,8 @@ class PEAR_Common extends PEAR
      * Get the implemented dependency types (php, ext, pkg etc.)
      *
      * @return array
-     * @static
      */
-    function getDependencyTypes()
+    public static function getDependencyTypes()
     {
         return $GLOBALS['_PEAR_Common_dependency_types'];
     }
@@ -358,9 +351,8 @@ class PEAR_Common extends PEAR
      * Get the implemented dependency relations (has, lt, ge etc.)
      *
      * @return array
-     * @static
      */
-    function getDependencyRelations()
+    public static function getDependencyRelations()
     {
         return $GLOBALS['_PEAR_Common_dependency_relations'];
     }
@@ -369,9 +361,8 @@ class PEAR_Common extends PEAR
      * Get the implemented file roles
      *
      * @return array
-     * @static
      */
-    function getFileRoles()
+    public static function getFileRoles()
     {
         return $GLOBALS['_PEAR_Common_file_roles'];
     }
@@ -380,9 +371,8 @@ class PEAR_Common extends PEAR
      * Get the implemented file replacement types in
      *
      * @return array
-     * @static
      */
-    function getReplacementTypes()
+    public static function getReplacementTypes()
     {
         return $GLOBALS['_PEAR_Common_replacement_types'];
     }
@@ -391,9 +381,8 @@ class PEAR_Common extends PEAR
      * Get the implemented file replacement types in
      *
      * @return array
-     * @static
      */
-    function getProvideTypes()
+    public static function getProvideTypes()
     {
         return $GLOBALS['_PEAR_Common_provide_types'];
     }
@@ -402,9 +391,8 @@ class PEAR_Common extends PEAR
      * Get the implemented file replacement types in
      *
      * @return array
-     * @static
      */
-    function getScriptPhases()
+    public static function getScriptPhases()
     {
         return $GLOBALS['_PEAR_Common_script_phases'];
     }
@@ -440,9 +428,8 @@ class PEAR_Common extends PEAR
     /**
      * @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;
@@ -489,7 +476,7 @@ class PEAR_Common extends PEAR
      */
     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);
     }
@@ -508,7 +495,7 @@ class PEAR_Common extends PEAR
      */
     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);
     }
@@ -527,7 +514,7 @@ class PEAR_Common extends PEAR
      */
     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);
     }
@@ -571,7 +558,7 @@ class PEAR_Common extends PEAR
     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();
@@ -604,7 +591,7 @@ class PEAR_Common extends PEAR
     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);
@@ -626,7 +613,7 @@ class PEAR_Common extends PEAR
     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, '');
@@ -814,24 +801,38 @@ class PEAR_Common extends PEAR
      * @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';