PageRenderTime 53ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/php-manual-en-20100611/php-chunked-xhtml/phar.decompress.html

#
HTML | 145 lines | 120 code | 25 blank | 0 comment | 0 complexity | edb079019f376aa1ed686665a22d4dd7 MD5 | raw file
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  5. <title>Decompresses the entire Phar archive</title>
  6. </head>
  7. <body><div class="manualnavbar" style="text-align: center;">
  8. <div class="prev" style="text-align: left; float: left;"><a href="phar.createdefaultstub.html">Phar::createDefaultStub</a></div>
  9. <div class="next" style="text-align: right; float: right;"><a href="phar.decompressfiles.html">Phar::decompressFiles</a></div>
  10. <div class="up"><a href="class.Phar.html">Phar</a></div>
  11. <div class="home"><a href="index.html">PHP Manual</a></div>
  12. </div><hr /><div id="phar.decompress" class="refentry">
  13. <div class="refnamediv">
  14. <h1 class="refname">Phar::decompress</h1>
  15. <p class="verinfo">(PHP &gt;= 5.3.0, PECL phar &gt;= 2.0.0)</p><p class="refpurpose"><span class="refname">Phar::decompress</span> &mdash; <span class="dc-title">Decompresses the entire Phar archive</span></p>
  16. </div>
  17. <div class="refsect1 description">
  18. <h3 class="title">Description</h3>
  19. <div class="methodsynopsis dc-description">
  20. <span class="type">object</span> <span class="methodname"><b>Phar::decompress</b></span>
  21. ([ <span class="methodparam"> <span class="type">string</span> <tt class="parameter">$extension</tt></span>
  22. ] )</div>
  23. <blockquote><p><b class="note">Note</b>: This
  24. method requires the <var class="filename">php.ini</var> setting <i>phar.readonly</i> to be
  25. set to <i>0</i> in order to work for <a href="class.Phar.html" class="classname">Phar</a>
  26. objects. Otherwise, a <a href="class.PharException.html" class="classname">PharException</a> will be thrown.<br /></p></blockquote>
  27. <p class="para">
  28. For tar-based and phar-based phar archives, this method decompresses the entire archive.
  29. </p>
  30. <p class="para">
  31. For Zip-based phar archives, this method fails with an exception.
  32. The <a href="ref.zlib.html" class="link">zlib</a> extension must be enabled to decompress
  33. an archive compressed with with gzip compression, and the
  34. <a href="ref.bzip2.html" class="link">bzip2</a> extension must be
  35. enabled in order to decompress an archive compressed with bzip2 compression.
  36. As with all functionality that modifies the contents of a phar, the
  37. <a href="phar.configuration.html#ini.phar.readonly" class="link">phar.readonly</a> INI variable must be off
  38. in order to succeed.
  39. </p>
  40. <p class="para">
  41. In addition, this method automatically changes the file extension of the archive,
  42. <i>.phar</i>
  43. by default for phar archives, or <i>.phar.tar</i> for tar-based phar archives.
  44. Alternatively, a file extension may be specified with the second
  45. parameter.
  46. </p>
  47. </div>
  48. <div class="refsect1 parameters">
  49. <h3 class="title">Parameters</h3>
  50. <p class="para">
  51. <dl>
  52. <dt>
  53. <span class="term"><i><tt class="parameter">extension</tt></i></span>
  54. <dd>
  55. <p class="para">
  56. For decompressing, the default file extensions
  57. are <i>.phar</i> and <i>.phar.tar</i>.
  58. Use this parameter to specify another file extension. Be aware
  59. that all executable phar archives must contain <i>.phar</i>
  60. in their filename.
  61. </p>
  62. </dd>
  63. </dt>
  64. </dl>
  65. </p>
  66. </div>
  67. <div class="refsect1 returnvalues">
  68. <h3 class="title">Return Values</h3>
  69. <p class="para">
  70. A <a href="class.Phar.html" class="classname">Phar</a> object is returned.
  71. </p>
  72. </div>
  73. <div class="refsect1 errors">
  74. <h3 class="title">Errors/Exceptions</h3>
  75. <p class="para">
  76. Throws <a href="class.badmethodcallexception.html" class="classname">BadMethodCallException</a> if
  77. the <a href="phar.configuration.html#ini.phar.readonly" class="link">phar.readonly</a>
  78. INI variable is on, the <a href="ref.zlib.html" class="link">zlib</a>
  79. extension is not available, or the <a href="ref.bzip2.html" class="link">bzip2</a> extension
  80. is not enabled.
  81. </p>
  82. </div>
  83. <div class="refsect1 examples">
  84. <h3 class="title">Examples</h3>
  85. <p class="para">
  86. <div class="example">
  87. <p><b>Example #1 A <span class="function"><b>Phar::decompress()</b></span> example</b></p>
  88. <div class="example-contents">
  89. <div class="phpcode"><code><span style="color: #000000">
  90. <span style="color: #0000BB">&lt;?php<br />$p&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Phar</span><span style="color: #007700">(</span><span style="color: #DD0000">'/path/to/my.phar'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'my.phar.gz'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">[</span><span style="color: #DD0000">'myfile.txt'</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #DD0000">'hi'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">[</span><span style="color: #DD0000">'myfile2.txt'</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #DD0000">'hi'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$p3&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$p2</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">decompress</span><span style="color: #007700">();&nbsp;</span><span style="color: #FF8000">//&nbsp;creates&nbsp;/path/to/my.phar<br /></span><span style="color: #0000BB">?&gt;</span>
  91. </span>
  92. </code></div>
  93. </div>
  94. </div>
  95. </p>
  96. </div>
  97. <div class="refsect1 seealso">
  98. <h3 class="title">See Also</h3>
  99. <p class="para">
  100. <ul class="simplelist">
  101. <li class="member"><span class="function"><a href="pharfileinfo.getcompressedsize.html" class="function" rel="rdfs-seeAlso">PharFileInfo::getCompressedSize()</a> - Returns the actual size of the file (with compression) inside the Phar archive</span></li>
  102. <li class="member"><span class="function"><a href="pharfileinfo.iscompressed.html" class="function" rel="rdfs-seeAlso">PharFileInfo::isCompressed()</a> - Returns whether the entry is compressed</span></li>
  103. <li class="member"><span class="function"><a href="pharfileinfo.compress.html" class="function" rel="rdfs-seeAlso">PharFileInfo::compress()</a> - Compresses the current Phar entry with either zlib or bzip2 compression</span></li>
  104. <li class="member"><span class="function"><a href="pharfileinfo.decompress.html" class="function" rel="rdfs-seeAlso">PharFileInfo::decompress()</a> - Decompresses the current Phar entry within the phar</span></li>
  105. <li class="member"><span class="function"><a href="phardata.compress.html" class="function" rel="rdfs-seeAlso">PharData::compress()</a> - Compresses the entire tar/zip archive using Gzip or Bzip2 compression</span></li>
  106. <li class="member"><span class="function"><a href="phar.cancompress.html" class="function" rel="rdfs-seeAlso">Phar::canCompress()</a> - Returns whether phar extension supports compression using either zlib or bzip2</span></li>
  107. <li class="member"><span class="function"><a href="phar.iscompressed.html" class="function" rel="rdfs-seeAlso">Phar::isCompressed()</a> - Returns Phar::GZ or PHAR::BZ2 if the entire phar archive is compressed (.tar.gz/tar.bz and so on)</span></li>
  108. <li class="member"><span class="function"><a href="phar.compress.html" class="function" rel="rdfs-seeAlso">Phar::compress()</a> - Compresses the entire Phar archive using Gzip or Bzip2 compression</span></li>
  109. <li class="member"><span class="function"><a href="phar.getsupportedcompression.html" class="function" rel="rdfs-seeAlso">Phar::getSupportedCompression()</a> - Return array of supported compression algorithms</span></li>
  110. <li class="member"><span class="function"><a href="phar.compressfiles.html" class="function" rel="rdfs-seeAlso">Phar::compressFiles()</a> - Compresses all files in the current Phar archive</span></li>
  111. <li class="member"><span class="function"><a href="phar.decompressfiles.html" class="function" rel="rdfs-seeAlso">Phar::decompressFiles()</a> - Decompresses all files in the current Phar archive</span></li>
  112. </ul>
  113. </p>
  114. </div>
  115. </div><hr /><div class="manualnavbar" style="text-align: center;">
  116. <div class="prev" style="text-align: left; float: left;"><a href="phar.createdefaultstub.html">Phar::createDefaultStub</a></div>
  117. <div class="next" style="text-align: right; float: right;"><a href="phar.decompressfiles.html">Phar::decompressFiles</a></div>
  118. <div class="up"><a href="class.Phar.html">Phar</a></div>
  119. <div class="home"><a href="index.html">PHP Manual</a></div>
  120. </div></body></html>