Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42214 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74509 invoked from network); 10 Dec 2008 15:56:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Dec 2008 15:56:33 -0000 Authentication-Results: pb1.pair.com header.from=rquadling@googlemail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=rquadling@googlemail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.219.20 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rquadling@googlemail.com X-Host-Fingerprint: 209.85.219.20 mail-ew0-f20.google.com Received: from [209.85.219.20] ([209.85.219.20:40001] helo=mail-ew0-f20.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A2/13-11210-EA6EF394 for ; Wed, 10 Dec 2008 10:56:33 -0500 Received: by ewy13 with SMTP id 13so802549ewy.23 for ; Wed, 10 Dec 2008 07:56:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :to:subject:mime-version:content-type; bh=9pXC93Z9jbbnPDtU438Pv5DOdX3nQDrOupo89XPXiaE=; b=pyOczLkc5v0AlvKWah/cXuayMTLmHJWsU8ubEeshspgE72w3oaCSaiJ/IFqzyJZRYZ xYzCZd16qg/vXRSQRo8dYj4ZVwNOmStgS7ku54lti3PzglOKYUWkwMHqjOn9DVFp1wFo Sa5KfRryrN+GYfrZQ2SydmHgRoxuDcldDyfX4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:mime-version:content-type; b=TLVEBNwTZaeVvU8OzkSlHwz00ZI3kGJrDhUn8+ocR/rwnhii6LBcpDth8qKzBMnAMW /Ip1+xZlYxUeuCGGTmyIPEhzyVKzVyyF6qFLAHupdMbGGrBef2b7pj+RP9KtHX8QBarC 4DHgm/sSJTmx30MN/7dVnQTC8CCqqembsGKBA= Received: by 10.103.160.10 with SMTP id m10mr567985muo.50.1228924587214; Wed, 10 Dec 2008 07:56:27 -0800 (PST) Received: by 10.103.212.17 with HTTP; Wed, 10 Dec 2008 07:56:27 -0800 (PST) Message-ID: <10845a340812100756vad13287xf8dc42b4009f5ce4@mail.gmail.com> Date: Wed, 10 Dec 2008 15:56:27 +0000 Reply-To: RQuadling@GoogleMail.com To: "PHP Internals List" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_97231_28921754.1228924587206" Subject: WIndows variant file for php-src/ext/session/mod_files.sh From: rquadling@googlemail.com ("Richard Quadling") ------=_Part_97231_28921754.1228924587206 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi. I've been playing with the session.save_path=n;path setting. The documentation says that there is a mod_files.sh file to help create the folder structure (which there is). But this won't run natively on windows. I've attached this patch below to create a windows variant (mod_files.bat) which works quite nicely. If someone can be nice enough to add it, I'll amend the docs to reflect the windows variant. If anyone actually reads it you'll notice that only upper case letters are used for the directory names. Windows is case insensitive and as such a === A with regards to file and folders. Regards, Richard Quadling. --- mod_files.bat +++ mod_files.bat @@ -0,0 +1,57 @@ +@ECHO OFF +SETLOCAL ENABLEDELAYEDEXPANSION + +IF _%1_==_AUTO_ ( + GOTO MakeDirs +) + +IF _%2_==__ ( + ECHO Usage %0 ^ ^ ^[^hash_bits^] + ECHO. + ECHO Where ^ is the session directory + ECHO ^ is the number of levels defined in session.save_path + ECHO ^[hash_bits^] is the number of bits defined in session.hash_bits_per_character + EXIT /B 1 +) + +SET /A Depth=%2 + 0 2>NUL +IF /I %ERRORLEVEL% EQU 9167 GOTO DepthError +IF _%Depth%_==__ GOTO DepthError +IF /I %Depth% LEQ 0 GOTO DepthError + +IF _%3_==__ GOTO DefaultBits + +SET /A Bits=%3 + 0 2>NUL +IF /I %ERRORLEVEL% EQU 9167 GOTO BitsError +IF _%Bits%_==__ GOTO BitsError +IF /I %Bits% LSS 4 GOTO BitsError +IF /I %Bits% GTR 6 GOTO BitsError +GOTO BitsSet + +:DefaultBits +SET Bits=4 +:BitsSet + +SET HashChars=0 1 2 3 4 5 6 7 8 9 A B C D E F +IF /I %Bits% GEQ 5 SET HashChars=!HashChars! G H I J K L M N O P Q R S T U V +IF /I %Bits% GEQ 6 SET HashChars=!HashChars! W X Y Z - , + +FOR %%A IN (%HashChars%) DO ( + ECHO Making %%A + CALL "%~0" AUTO "%~1\%%~A" %Depth% +) +GOTO :EOF + +:MakeDirs +MKDIR "%~2" +SET /A ThisDepth=%3 - 1 +IF /I %ThisDepth% GTR 0 FOR %%A IN (%HashChars%) DO CALL "%~0" AUTO "%~2\%%~A" %ThisDepth% +GOTO :EOF + +:DepthError +ECHO ERROR: Invalid depth : %2 +EXIT /B 0 + +:BitsError +ECHO ERROR: Invalid hash_bits : %3 +EXIT /B 0 -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" ------=_Part_97231_28921754.1228924587206--