cvs: pear /PEAR_PackageUpdate PackageUpdate.php

[email protected] ("Laurent Laville")
Newsgroups php.pear.cvs
Message-ID <cvsfarell1209311951@cvsserver>
farell		Sun Apr 27 15:59:11 2008 UTC

  Modified files:              
    /pear/PEAR_PackageUpdate	PackageUpdate.php 
  Log:
  default configuration file (.ppurc|ppurc.ini) 
  is loaded/saved from/into PEAR configuration directory (PEAR 1.7.0+ cfg_dir directive)
  
http://cvs.php.net/viewvc.cgi/pear/PEAR_PackageUpdate/PackageUpdate.php?r1=1.29&r2=1.30&diff_format=u
Index: pear/PEAR_PackageUpdate/PackageUpdate.php
diff -u pear/PEAR_PackageUpdate/PackageUpdate.php:1.29 pear/PEAR_PackageUpdate/PackageUpdate.php:1.30
--- pear/PEAR_PackageUpdate/PackageUpdate.php:1.29	Sun Apr 27 14:40:54 2008
+++ pear/PEAR_PackageUpdate/PackageUpdate.php	Sun Apr 27 15:59:11 2008
@@ -21,7 +21,7 @@
  * @author    Laurent Laville <[email protected]>
  * @copyright 2006-2008 Scott Mattocks
  * @license   http://www.php.net/license/3_01.txt  PHP License 3.01
- * @version   CVS: $Id: PackageUpdate.php,v 1.29 2008/04/27 14:40:54 farell Exp $
+ * @version   CVS: $Id: PackageUpdate.php,v 1.30 2008/04/27 15:59:11 farell Exp $
  * @link      http://pear.php.net/package/PEAR_PackageUpdate
  * @since     File available since Release 0.4.0a1
  */
@@ -607,15 +607,26 @@
      */
     function determinePrefFile()
     {
-        // Determine the preferences file.
-        // Borrowed from PEAR_Config
-
-        $ds = DIRECTORY_SEPARATOR;
         if (OS_WINDOWS) {
-            $prefFile = PEAR_CONFIG_SYSCONFDIR . $ds . 'ppurc.ini';
+            $cfgName = 'ppurc.ini';
+        } else {
+            $cfgName = '.ppurc';
+        }
+
+        // PEAR 1.7.0 introduced new feature like configuration directory (cfg_dir)
+        $config =& PEAR_Config::singleton($this->user_file, $this->system_file);
+        $cfgDir = $config->get('cfg_dir');
+
+        if (!is_null($cfgDir) && is_dir($cfgDir)) {
+            // detect PEAR configuration directive (cfg_dir)
         } else {
-            $prefFile = getenv('HOME') . $ds . '.ppurc';
+            if (OS_WINDOWS) {
+                $cfgDir = PEAR_CONFIG_SYSCONFDIR;
+            } else {
+                $cfgDir = getenv('HOME');
+            }
         }
+        $prefFile = $cfgDir . DIRECTORY_SEPARATOR . $cfgName;
 
         return $prefFile;
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.