From 2ad96985c76309facd14e0425d46dbd17eadb73e Mon Sep 17 00:00:00 2001 From: Steph Fox Date: Tue, 12 Feb 2008 16:42:35 +0000 Subject: [PATCH] - it helps if you add the new files :) --- .../tests/tar/files/frontcontroller.phar.inc | 13 ++ .../tests/tar/files/frontcontroller.phar.tar | Bin 0 -> 6144 bytes .../tar/files/frontcontroller10.phar.inc | 20 +++ .../tar/files/frontcontroller10.phar.tar | Bin 0 -> 3072 bytes .../tar/files/frontcontroller11.phar.inc | 20 +++ .../tar/files/frontcontroller11.phar.tar | Bin 0 -> 3072 bytes .../tar/files/frontcontroller12.phar.inc | 20 +++ .../tar/files/frontcontroller12.phar.tar | Bin 0 -> 3072 bytes .../tests/tar/files/frontcontroller2.phar.inc | 12 ++ .../tests/tar/files/frontcontroller2.phar.tar | Bin 0 -> 5120 bytes .../tests/tar/files/frontcontroller3.phar.inc | 18 ++ .../tests/tar/files/frontcontroller3.phar.tar | Bin 0 -> 5120 bytes .../tests/tar/files/frontcontroller4.phar.inc | 18 ++ .../tests/tar/files/frontcontroller4.phar.tar | Bin 0 -> 5120 bytes .../tests/tar/files/frontcontroller5.phar.inc | 12 ++ .../tests/tar/files/frontcontroller5.phar.tar | Bin 0 -> 5120 bytes .../tests/tar/files/frontcontroller6.phar.inc | 12 ++ .../tests/tar/files/frontcontroller6.phar.tar | Bin 0 -> 5120 bytes .../tests/tar/files/frontcontroller7.phar.inc | 12 ++ .../tests/tar/files/frontcontroller7.phar.tar | Bin 0 -> 5120 bytes .../tests/tar/files/frontcontroller8.phar.inc | 13 ++ .../tests/tar/files/frontcontroller8.phar.tar | Bin 0 -> 6144 bytes .../tests/tar/files/frontcontroller9.phar.inc | 14 ++ .../tests/tar/files/frontcontroller9.phar.tar | Bin 0 -> 6144 bytes .../tests/tar/files/make_invalid_tar.php.inc | 9 + ext/phar/tests/tar/files/tarmaker.php.inc | 169 ++++++++++++++++++ 26 files changed, 362 insertions(+) create mode 100644 ext/phar/tests/tar/files/frontcontroller.phar.inc create mode 100644 ext/phar/tests/tar/files/frontcontroller.phar.tar create mode 100644 ext/phar/tests/tar/files/frontcontroller10.phar.inc create mode 100644 ext/phar/tests/tar/files/frontcontroller10.phar.tar create mode 100644 ext/phar/tests/tar/files/frontcontroller11.phar.inc create mode 100644 ext/phar/tests/tar/files/frontcontroller11.phar.tar create mode 100644 ext/phar/tests/tar/files/frontcontroller12.phar.inc create mode 100644 ext/phar/tests/tar/files/frontcontroller12.phar.tar create mode 100644 ext/phar/tests/tar/files/frontcontroller2.phar.inc create mode 100644 ext/phar/tests/tar/files/frontcontroller2.phar.tar create mode 100644 ext/phar/tests/tar/files/frontcontroller3.phar.inc create mode 100644 ext/phar/tests/tar/files/frontcontroller3.phar.tar create mode 100644 ext/phar/tests/tar/files/frontcontroller4.phar.inc create mode 100644 ext/phar/tests/tar/files/frontcontroller4.phar.tar create mode 100644 ext/phar/tests/tar/files/frontcontroller5.phar.inc create mode 100644 ext/phar/tests/tar/files/frontcontroller5.phar.tar create mode 100644 ext/phar/tests/tar/files/frontcontroller6.phar.inc create mode 100644 ext/phar/tests/tar/files/frontcontroller6.phar.tar create mode 100644 ext/phar/tests/tar/files/frontcontroller7.phar.inc create mode 100644 ext/phar/tests/tar/files/frontcontroller7.phar.tar create mode 100644 ext/phar/tests/tar/files/frontcontroller8.phar.inc create mode 100644 ext/phar/tests/tar/files/frontcontroller8.phar.tar create mode 100644 ext/phar/tests/tar/files/frontcontroller9.phar.inc create mode 100644 ext/phar/tests/tar/files/frontcontroller9.phar.tar create mode 100644 ext/phar/tests/tar/files/make_invalid_tar.php.inc create mode 100644 ext/phar/tests/tar/files/tarmaker.php.inc diff --git a/ext/phar/tests/tar/files/frontcontroller.phar.inc b/ext/phar/tests/tar/files/frontcontroller.phar.inc new file mode 100644 index 0000000000..6f426e8864 --- /dev/null +++ b/ext/phar/tests/tar/files/frontcontroller.phar.inc @@ -0,0 +1,13 @@ +setStub(' diff --git a/ext/phar/tests/tar/files/frontcontroller.phar.tar b/ext/phar/tests/tar/files/frontcontroller.phar.tar new file mode 100644 index 0000000000000000000000000000000000000000..522d097845e6ecce56a7b2f3352a6ae824657d17 GIT binary patch literal 6144 zcmeHJT}#6-6y0;d{}9F=I*^&BZ3de-L<$O1N0mJZAzQ1hu%z_E4`lz{G`@At`Owr# zlZVo#&AGQH_uLaYN}{BvcEECAjH^-P{MW^X792YejgjNZ85i4j^?N1HMV8aF2cZ)1 z_Jc+-Z-0_HLuCvI`P1|y%Zrt|Mj!?Klm0Eosp?-egPne%goKXk|8yq$zp)TSFqyoD ztMbMiPK|IKanR>H$v_YXfbkrp1$$uqsqsQn5)_-n91!njc?<^R&hwX^FIEw9c|N}< z7q{1otGVY3ATT>SGL-C_2CanwI(kl?YC+l$a!~&ee&heh*^gM`n~v*W`+tqK^betE zY5SSl#1HEq;i~^*i1hhi?Y2mC>HpxdVCy{Q42X7M4nMXH1lA#1!9dJ{@J-#(U;g7S p^bdFR?;@)ag1YYiVH$!s1DkgsOQ8|Ybr8*fWsetStub(' diff --git a/ext/phar/tests/tar/files/frontcontroller10.phar.tar b/ext/phar/tests/tar/files/frontcontroller10.phar.tar new file mode 100644 index 0000000000000000000000000000000000000000..d43ed916a13489480678609c069207eb1efe69e1 GIT binary patch literal 3072 zcmeHHU2DQH6!lrye+Xp{6=aJVTX17iBx1pjEUmt5BhJPw-gaU3)vY6i8?8e1QdpGFD1T7cfWdy)SDtD&zrDA5++?;G8zY(l>6=4( z494mGlv=i!a`P`HHZZuzswe^FDC-cHRa=5h7kK_t&0ir%-;vkrO*Ajg1Y$iO)qe~B z(7#R^t^8kc0iu7}}yY88Pq_ Z4n(MXcTqiI`sLBG17!!w4*c5=yaOHTw2}Y- literal 0 HcmV?d00001 diff --git a/ext/phar/tests/tar/files/frontcontroller11.phar.inc b/ext/phar/tests/tar/files/frontcontroller11.phar.inc new file mode 100644 index 0000000000..2fa15f097e --- /dev/null +++ b/ext/phar/tests/tar/files/frontcontroller11.phar.inc @@ -0,0 +1,20 @@ +setStub(' diff --git a/ext/phar/tests/tar/files/frontcontroller11.phar.tar b/ext/phar/tests/tar/files/frontcontroller11.phar.tar new file mode 100644 index 0000000000000000000000000000000000000000..c8f98a1e78f04cc44c0d48d8c9ad53e6aacf08a8 GIT binary patch literal 3072 zcmeHHU2B6d6zy|i{~^d86w0Q~Ds*E-N{WK*vS|CVjbNv&eW*&*Zu|F(b{|f*Diom) z$wNr4CpS0edd?;a!nccLo%FgJaxrvWuisF{i%HWpS&O>xuov_J{j0iB z*T11DO8ZwFf#mvU`bX?17>%}h^x}qe7gEuu)PMh+r2!DCvijM6tA~ZEB9WM7>{Gsm zt70LtK={0lfe^<@3W7}lqBsLIj~*l8m%YIGasa+uh@B$DG98ah?q-PD2xf`E`1Y)S SM8o+}&H!hCGr$=r82A7ir?K4t literal 0 HcmV?d00001 diff --git a/ext/phar/tests/tar/files/frontcontroller12.phar.inc b/ext/phar/tests/tar/files/frontcontroller12.phar.inc new file mode 100644 index 0000000000..693ef0aa01 --- /dev/null +++ b/ext/phar/tests/tar/files/frontcontroller12.phar.inc @@ -0,0 +1,20 @@ +setStub(' diff --git a/ext/phar/tests/tar/files/frontcontroller12.phar.tar b/ext/phar/tests/tar/files/frontcontroller12.phar.tar new file mode 100644 index 0000000000000000000000000000000000000000..06e7e59b03ed4677e37bd252d5d13ad712b7d5aa GIT binary patch literal 3072 zcmd1IOG&NJE66BdpdBy(0W&i*bQ{3pAi~7V#K6$N+{D1h+{o0>7$jt7YHW(Go+kX# z;*!K71_J|{7(Vz7wXp}rJy%&`QG7~iZh?kMe6VX!m}^k9Qh-MQknQ896su{CO+MH; z$TJ`$-p|q3m4FgAPaju&%7R=2LtTSI;zNTxahVk0;TRN8$VFg9L^ums9U-@Y)uKCa z@W(3gE(B)%#3KFTlF}sF6#}6Aj5q%SvpstLH#ae)PnI0b|G@ko089i{R=K5l>A|T* zWvN9PiA6<;l^TdbKu19dIcFib@C*bLLe3|ez)}NZYI$lBh@k-#NKMYjS5V5&FDO<> z$xKnm%P&zVD$R?@Q$i_WT>Zjy6kr7rP*;4shoetOytBV=0I(zp0ve=XZ^z3;d>S8B RIT`|^Aut*OqalD90sv#~vL*lk literal 0 HcmV?d00001 diff --git a/ext/phar/tests/tar/files/frontcontroller2.phar.inc b/ext/phar/tests/tar/files/frontcontroller2.phar.inc new file mode 100644 index 0000000000..8ae1171a38 --- /dev/null +++ b/ext/phar/tests/tar/files/frontcontroller2.phar.inc @@ -0,0 +1,12 @@ +setStub(' diff --git a/ext/phar/tests/tar/files/frontcontroller2.phar.tar b/ext/phar/tests/tar/files/frontcontroller2.phar.tar new file mode 100644 index 0000000000000000000000000000000000000000..857b1168901195870d265265ff233dc48a1e30f7 GIT binary patch literal 5120 zcmeHKU2B6d6z#LH{}4hS6iOFA8ljGrF@z1et=Q40K}f5c4rYQM?ZeoApV~LKwlBu5 zaPuG<&AEq@oO_UuWh@732dM|8v|Xi{-(PHE64xP?YdI6Uo|;hm$M@~^ojjL$!LtD& zoq(MmNSuiCBMpo@Q=qax&o1+#T&rsYjm3}o-=uEa|E^<#|2x~|!$4QFs{dJUt) zyJ%hC=y(_NBHBh79wE%@bAb&{i#D-9SO}S;FbPpA3Y3-UONu>h%QF_1A5tGO|8X@! zL$>sTl^;~A7`wZfKeOAXhsFKe4|Kyrv+E1(Fd=x;s{(xdF5eVaJn4Tze#w8!RZMFS z5BcAV%uwWiD$um|TrIcL{z>% literal 0 HcmV?d00001 diff --git a/ext/phar/tests/tar/files/frontcontroller3.phar.inc b/ext/phar/tests/tar/files/frontcontroller3.phar.inc new file mode 100644 index 0000000000..9729d0065b --- /dev/null +++ b/ext/phar/tests/tar/files/frontcontroller3.phar.inc @@ -0,0 +1,18 @@ +setStub(' "a.phps"); + if (isset($b[$a])) return $b[$a]; + return $a; +} +Phar::webPhar("whatever", "/index.php", null, array(), "s"); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/tar/files/frontcontroller3.phar.tar b/ext/phar/tests/tar/files/frontcontroller3.phar.tar new file mode 100644 index 0000000000000000000000000000000000000000..f733884d122423acf03d633cc2536db7ac40b923 GIT binary patch literal 5120 zcmeHJO>2Wd5Y1WeKMacpg^+0c2qaBHDMAZr8`6?XTV#!TsC(Q6!x*q z>(7H2P#h;Ic%cVTOo3$4V}w}n6()|Cy(Y5c*f+B#NY0%-o!QeIuj5>vkMEs}+v~~I z*q+KtA4Wq_;6}0|4vbqb$unnsd-<=bKkR?~+kJrx%oFE-z5ls%)xQZ^PI10)_w&DF rRrkN8>h=Af?{6uh7yBQ+);}8uva;D8AaR|du0UOZx&n0t{setStub(' false); + if (isset($b[$a])) return $b[$a]; + return $a; +} +Phar::webPhar("whatever", "index.php", null, array(), "s"); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/tar/files/frontcontroller4.phar.tar b/ext/phar/tests/tar/files/frontcontroller4.phar.tar new file mode 100644 index 0000000000000000000000000000000000000000..5d11af499c181d8bada5b7a9d0579368cb034865 GIT binary patch literal 5120 zcmeHJQES355cavy|8SH(v>=*lZ9%6pMqvZDi5tFbqolU39WE_Ns~h5fUs~OeGUij9 zVDF*iE|u2wYrn=7Ev<|BK;7q2@BtPf6*O#M5_v-$3 zd^2(;n%;xqK$iAP;+)pF@s_*_zVJc(BlOGsH`{{4+L}Le{8#h;C{=c{PH^62nb`0S uisYFw-nZk`42zipSJ@|UvG}!xN=ctpvpj%fhq(4nt?A?jEfoo literal 0 HcmV?d00001 diff --git a/ext/phar/tests/tar/files/frontcontroller5.phar.inc b/ext/phar/tests/tar/files/frontcontroller5.phar.inc new file mode 100644 index 0000000000..d6204c7d97 --- /dev/null +++ b/ext/phar/tests/tar/files/frontcontroller5.phar.inc @@ -0,0 +1,12 @@ +setStub(' "oops")); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/tar/files/frontcontroller5.phar.tar b/ext/phar/tests/tar/files/frontcontroller5.phar.tar new file mode 100644 index 0000000000000000000000000000000000000000..e6e9015bf8e23f9532eb73997712f8dcbc2d39da GIT binary patch literal 5120 zcmeHJ-%G|6`BQP47v(};BWNW4oBk1UyZZMWdq0vqa{Zr8s{XIdsv;PTHu0kV zF!W7Ai+CLi-2!^bqWG<@jmlu;}cC>;0mXn~Kr!&A4158}8f=*W literal 0 HcmV?d00001 diff --git a/ext/phar/tests/tar/files/frontcontroller6.phar.inc b/ext/phar/tests/tar/files/frontcontroller6.phar.inc new file mode 100644 index 0000000000..66212d82e8 --- /dev/null +++ b/ext/phar/tests/tar/files/frontcontroller6.phar.inc @@ -0,0 +1,12 @@ +setStub(' 100)); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/tar/files/frontcontroller6.phar.tar b/ext/phar/tests/tar/files/frontcontroller6.phar.tar new file mode 100644 index 0000000000000000000000000000000000000000..d30b7ab9eb204c030bc020ea5bf21043abe10047 GIT binary patch literal 5120 zcmeHKU2B6d6z#LH{}4hS6r_tEi%_?gF@z1et+>&rfyC;j!$pbOu8jTnMYo3{V|_{| zm^?^sNKUTDd+tFpDUxC&cA#cpjJvnA>)#Ix8OX7b>6kXQnx!*rIoq{AgXfyAt2C#8w*yuC_&f^p@)F5_WI!??8TdyAz5rDsetStub(' null)); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/tar/files/frontcontroller7.phar.tar b/ext/phar/tests/tar/files/frontcontroller7.phar.tar new file mode 100644 index 0000000000000000000000000000000000000000..c7ccc940c149fafcc84595c7c736094bc574e4b5 GIT binary patch literal 5120 zcmeHJQEP)R5bm?E{}4hS6r@YlMyOlM7{UhKR@~^*AjImX!$pbOZjAl+se7u(`qFd- zlLzsR_}%&CzPr#-7G(pm3)Kr_+>X-te;+0qBillTZCH3xyC&EgxAzON%e>^z@UI846>dl0W6=c~Sb}8bKrRzw~dIsI7n78XrfJJ=g!myz2kTvMPeySxmrAt>xaAL?ZWj`%>nb-nIf#(R literal 0 HcmV?d00001 diff --git a/ext/phar/tests/tar/files/frontcontroller8.phar.inc b/ext/phar/tests/tar/files/frontcontroller8.phar.inc new file mode 100644 index 0000000000..f51a762806 --- /dev/null +++ b/ext/phar/tests/tar/files/frontcontroller8.phar.inc @@ -0,0 +1,13 @@ +setStub(' "foo/bar", "phps" => Phar::PHP, "php" => Phar::PHPS)); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/tar/files/frontcontroller8.phar.tar b/ext/phar/tests/tar/files/frontcontroller8.phar.tar new file mode 100644 index 0000000000000000000000000000000000000000..98495717cec043718c39f6c04632a3c90bccd93d GIT binary patch literal 6144 zcmeHLU2DQH6y0-S{~-h)S`dx3AE28uM!|vGiVmL!CE9Acxum46ZjAl+B^5+0%%_N~ z$wRmaH#avYIro&}RvM?-mDGkra~$V*lX8C7S*U|t3z@EIId19B?PGr_<08v3yFy4x z@XHSxC$w|bt?5jN_I8p|ILtJyXNyp z(CclZxiECNjd31rA_kiPCM1kL#oOQmQmofafEmMII($o45Zn#`TvFPerAT$T8Ag=`WwGC!LSbU^Q{)1&f7I{Jm;N?I!zJK;tr;LA&z>-n& r-dc%X+DT9IzpDQ({~aJLp~Jv6=RYTW_Ye+cD+Ck*3IT;cJrMW>setStub(' "foo/bar", "phps" => Phar::PHP, "php" => Phar::PHPS)); +echo "oops did not run\n"; +var_dump($_ENV, $_SERVER); +__HALT_COMPILER();'); +?> diff --git a/ext/phar/tests/tar/files/frontcontroller9.phar.tar b/ext/phar/tests/tar/files/frontcontroller9.phar.tar new file mode 100644 index 0000000000000000000000000000000000000000..481864c1cf465897f23968ad6d7298f2af522da5 GIT binary patch literal 6144 zcmeHJQES355Z<$}{}74~Er_PIwxF9bM!|vGiVmL!CE9AcX;RWwH^%<^k~&0Nm@mc& zCJ!NZy?l55(l1w3kHa{*5;`CsmSq)_$`{2~yOC71YL`fr+gQU5k`iK(W5dg1!N>9J$4xa=cn zx0e~7j{>?1sEQ~>pQ@&Hejlxa36D{gb%@e{MJP3(MA#2L_-DfmoGlhLu-T@(#d8JR zc7ZY@q%lExFmE%tbCb*My9|Nv<$+t@h^GvuApr^@aRU6v2biRQX808=oyrPP&(D^z zTJ@Z#aSc?xkuw}SL$=HF`gemD@BaDGeHb`HRqKFW_qtLzZfWi_fa>h9_FYG}4(cDm zQvYvRO{xE*pF|mu_5aiSXO&Y+&lxa)#I^nH+a1=wVHNv-%QBl=0FevX|HBx}GCWNq zf&se@RPF0qB;gYKoEVrQ;a--ebgte{=s3)epr{AuplUC!lNG9Vd{ K3`hq4oq-=B1C(C? literal 0 HcmV?d00001 diff --git a/ext/phar/tests/tar/files/make_invalid_tar.php.inc b/ext/phar/tests/tar/files/make_invalid_tar.php.inc new file mode 100644 index 0000000000..c18bd199b3 --- /dev/null +++ b/ext/phar/tests/tar/files/make_invalid_tar.php.inc @@ -0,0 +1,9 @@ +tmp, 'oopsie'); + fclose($this->tmp); +} +} \ No newline at end of file diff --git a/ext/phar/tests/tar/files/tarmaker.php.inc b/ext/phar/tests/tar/files/tarmaker.php.inc new file mode 100644 index 0000000000..902507881a --- /dev/null +++ b/ext/phar/tests/tar/files/tarmaker.php.inc @@ -0,0 +1,169 @@ +compress = $compress; + if ($compress === 'bz2' && !function_exists('bzopen')) { + throw new PEAR2_Pyrus_Developer_Creator_Exception( + 'bzip2 extension not available'); + } + if ($compress === 'zlib' && !function_exists('gzopen')) { + throw new PEAR2_Pyrus_Developer_Creator_Exception( + 'zlib extension not available'); + } + $this->path = $path; + } + + /** + * save a file inside this package + * + * This code is modified from Vincent Lascaux's File_Archive + * package, which is licensed under the LGPL license. + * @param string relative path within the package + * @param string|resource file contents or open file handle + */ + function addFile($path, $fileOrStream, $stat = null) + { + clearstatcache(); + if ($stat === null) { + if (is_resource($fileOrStream)) { + $stat = fstat($fileOrStream); + } else { + $stat = array( + 'mode' => 0x8000 + 0644, + 'uid' => 0, + 'gid' => 0, + 'size' => strlen($fileOrStream), + 'mtime' => time(), + ); + } + } + + $link = null; + if ($stat['mode'] & 0x4000) { + $type = 5; // Directory + } else if ($stat['mode'] & 0x8000) { + $type = 0; // Regular + } else if ($stat['mode'] & 0xA000) { + $type = 1; // Link + $link = @readlink($current); + } else { + $type = 9; // Unknown + } + + $filePrefix = ''; + if (strlen($path) > 255) { + throw new Exception( + "$path is too long, must be 255 characters or less" + ); + } else if (strlen($path) > 100) { + $filePrefix = substr($path, 0, strlen($path)-100); + $path = substr($path, -100); + } + + $block = pack('a100a8a8a8a12A12', + $path, + decoct($stat['mode']), + sprintf('%6s ',decoct($stat['uid'])), + sprintf('%6s ',decoct($stat['gid'])), + sprintf('%11s ',decoct($stat['size'])), + sprintf('%11s ',decoct($stat['mtime'])) + ); + + $blockend = pack('a1a100a6a2a32a32a8a8a155a12', + $type, + $link, + 'ustar', + '00', + 'Pyrus', + 'Pyrus', + '', + '', + $filePrefix, + ''); + + $checkheader = array_merge(str_split($block), str_split($blockend)); + if (!function_exists('_pear2tarchecksum')) { + function _pear2tarchecksum($a, $b) {return $a + ord($b);} + } + $checksum = 256; // 8 * ord(' '); + $checksum += array_reduce($checkheader, '_pear2tarchecksum'); + + $checksum = pack('a8', sprintf('%6s ', decoct($checksum))); + + fwrite($this->tmp, $block . $checksum . $blockend, 512); + if (is_resource($fileOrStream)) { + stream_copy_to_stream($fileOrStream, $this->tmp); + if ($stat['size'] % 512) { + fwrite($this->tmp, str_repeat("\0", 512 - $stat['size'] % 512)); + } + } else { + fwrite($this->tmp, $fileOrStream); + if (strlen($fileOrStream) % 512) { + fwrite($this->tmp, str_repeat("\0", 512 - strlen($fileOrStream) % 512)); + } + } + } + + /** + * Initialize the package creator + */ + function init() + { + switch ($this->compress) { + case 'zlib' : + $this->tmp = gzopen($this->path, 'wb'); + break; + case 'bz2' : + $this->tmp = bzopen($this->path, 'w'); + break; + case 'none' : + $this->tmp = fopen($this->path, 'wb'); + break; + default : + throw new Exception( + 'unknown compression type ' . $this->compress); + } + } + + /** + * Create an internal directory, creating parent directories as needed + * + * @param string $dir + */ + function mkdir($dir) + { + $this->addFile($dir, "", array( + 'mode' => 0x4000 + 0644, + 'uid' => 0, + 'gid' => 0, + 'size' => 0, + 'mtime' => time(), + )); + } + + /** + * Finish saving the package + */ + function close() + { + fwrite($this->tmp, pack('a1024', '')); + fclose($this->tmp); + } +} \ No newline at end of file -- 2.50.1