Re: cvs: pear-core /PEAR2 Config.php

From: Date: Sat, 30 Dec 2006 16:32:00 +0000
Subject: Re: cvs: pear-core /PEAR2 Config.php
References: 1  Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-5323@lists.php.net to get a copy of this message
Bonjour, Greg Beaver wrote:
cellog Fri Dec 29 18:46:56 2006 UTC
  Modified files:                  /pear-core/PEAR2	Config.php 
I missed the fundation of this PEAR2. Congrats ! I hope I get enough time to get back active as an helper. ( I know some insane protocols ) Outer .phpt scripts the pear way and this insane sownload-all protocol , are there things to pay attention to & too? Wish you all a nice jump into 2007 ! -- toggg > Log: > it took forever to find, but here is a MUCH better way to retrieve the > user PEAR configuration path on windows, it will go in > My Documents/pear/ for the current user > > http://cvs.php.net/viewvc.cgi/pear-core/PEAR2/Config.php?r1=1.2&r2=1.3&diff_format=u > Index: pear-core/PEAR2/Config.php > diff -u pear-core/PEAR2/Config.php:1.2 pear-core/PEAR2/Config.php:1.3 > --- pear-core/PEAR2/Config.php:1.2 Fri Dec 29 05:48:22 2006 > +++ pear-core/PEAR2/Config.php Fri Dec 29 18:46:56 2006 > @@ -141,16 +141,17 @@ > private function _locateLocalSettingsDirectory() > { > if (class_exists('COM')) { > - // windows > - $locator = new COM('WbemScripting.SWbemLocator'); > - $services = $locator->ConnectServer('', '\\root\\default'); > - $services->Security_->ImpersonationLevel = 0x3; > - $registry = $services->Get("StdRegProv"); > - $appdata = new VARIANT; > - $registry->GetStringValue(0x80000001, > - 'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders', > - 'Local AppData', $appdata); > - return strval($appdata); > + // windows, grab current user My Documents folder > + $info = new COM('winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\cimv2'); > + $users = $info->ExecQuery("Select * From Win32_ComputerSystem"); > + foreach ($users as $user) { > + $d = explode('\\', $user->UserName); > + $curuser = $d[1]; > + } > + $registry = new COM('Wscript.Shell'); > + return $registry->RegRead( > + 'HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\' . > + 'Explorer\\DocFolderPaths\\' . $curuser); > } else { > return getenv('HOME'); > }

« previous php.pear.core (#5323) next »