[ Index ] |
|
Code source de Symfony 1.0.0 |
1 <?php 2 /* 3 * 4 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 5 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 6 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 7 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 8 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 9 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 10 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 11 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 12 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 13 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 14 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 15 * 16 * This software consists of voluntary contributions made by many individuals 17 * and is licensed under the LGPL. For more information please see 18 * <http://phing.info>. 19 */ 20 21 require_once 'phing/tasks/ext/ExtractBaseTask.php'; 22 require_once 'phing/system/io/FileSystem.php'; 23 require_once 'phing/lib/Zip.php'; 24 25 /** 26 * Extracts one or several zip archive using PEAR Archive_Zip (which is presently unreleased 27 * and included with Phing). 28 * 29 * @author Joakim Bodin <joakim.bodin+phing@gmail.com> 30 * @version $Revision: 1.0 $ 31 * @package phing.tasks.ext 32 * @since 2.2.0 33 */ 34 class UnzipTask extends ExtractBaseTask { 35 36 protected function extractArchive(PhingFile $zipfile) 37 { 38 $extractParams = array('add_path' => $this->todir->getAbsolutePath()); 39 if(!empty($this->removepath)) 40 { 41 $extractParams['remove_path'] = $this->removepath; 42 } 43 44 $this->log("Extracting zip: " . $zipfile->__toString() . ' to ' . $this->todir->__toString(), PROJECT_MSG_INFO); 45 46 try { 47 $zip = new Archive_Zip($zipfile->getAbsolutePath()); 48 49 $extractResponse = $zip->extract($extractParams); 50 if(is_array($extractResponse)) { 51 foreach ($extractResponse as $extractedPath) { 52 $this->log('Extracted' . $extractedPath['stored_filename'] . ' to ' . $this->todir->__toString(), PROJECT_MSG_VERBOSE); 53 } 54 } else if ($extractResponse === 0) { 55 throw new BuildException('Failed to extract zipfile: ' . $zip->errorInfo(true)); 56 } 57 } catch (IOException $ioe) { 58 $msg = "Could not extract ZIP: " . $ioe->getMessage(); 59 throw new BuildException($msg, $ioe, $this->getLocation()); 60 } 61 } 62 63 protected function listArchiveContent(PhingFile $zipfile) 64 { 65 $zip = new Archive_Zip($zipfile->getAbsolutePath()); 66 return $zip->listContent(); 67 } 68 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |