lib/magento/Archive/Tar.php
protected function _unpackCurrentTar($destination)
    {
        $archiveReader = $this->_getReader();
        $list = array();

        while (!$archiveReader->eof()) {
            $header = $this->_extractFileHeader();

            if (!$header) {
                continue;
            }

            $currentFile = $destination . $header['name'];
            $dirname = dirname($currentFile);

            if (in_array($header['type'], array("0",chr(0), ''))) {

                if(!file_exists($dirname)) {
                    $mkdirResult = @mkdir($dirname, 0777, true);

                    if (false === $mkdirResult) {
                        throw new Mage_Exception('Failed to create directory ' . $dirname);
                    }
                }

                $this->_extractAndWriteFile($header, $currentFile);
                $list[] = $currentFile;

            } elseif ($header['type'] == '5') {

                if(!file_exists($dirname)) {
                    $mkdirResult = @mkdir($currentFile, $header['mode'], true);

                    if (false === $mkdirResult) {
                        throw new Mage_Exception('Failed to create directory ' . $currentFile);
                    }
                }
                $list[] = $currentFile . DS;
            } elseif ($header['type'] == '2') {

                //we do not interrupt unpack process if symlink creation failed as symlinks are not so important
                @symlink($header['symlink'], $currentFile);
            }
        }

        return $list;
    }
protected function _unpackCurrentTar($destination)
    {
        $archiveReader = $this->_getReader();
        $list = array();

        while (!$archiveReader->eof()) {
            $header = $this->_extractFileHeader();

            if (!$header) {
                continue;
            }

            $currentFile = $destination . $header['name'];
            $dirname = dirname($currentFile);

            if (in_array($header['type'], array("0",chr(0), ''))) {

                if(!file_exists($dirname)) {
                    $mkdirResult = @mkdir($dirname, 0777, true);

                    if (false === $mkdirResult) {
                        throw new Mage_Exception('Failed to create directory ' . $dirname);
                    }
                }

                $this->_extractAndWriteFile($header, $currentFile);
                $list[] = $currentFile;

            } elseif ($header['type'] == '5') {

                if(!file_exists($dirname)) {
                    $mkdirResult = @mkdir($currentFile, $header['mode'], true);

                    if (false === $mkdirResult) {
                        throw new Mage_Exception('Failed to create directory ' . $currentFile);
                    }
                }
                $list[] = $currentFile . DS;
            } elseif ($header['type'] == '2') {

                //we do not interrupt unpack process if symlink creation failed as symlinks are not so important
                @symlink($header['symlink'], $currentFile);
            }
        }

        return $list;
    }
protected function _unpackCurrentTar ( $ destination ) { $ archiveReader = $ this -> _getReader ( ) ; $ list = array ( ) ; while ( ! $ archiveReader -> eof ( ) ) { $ header = $ this -> _extractFileHeader ( ) ; if ( ! $ header ) { continue ; } $ currentFile = $ destination . $ header [ 'name' ] ; $ dirname = dirname ( $ currentFile ) ; if ( in_array ( $ header [ 'type' ] , array ( "0" , chr ( 0 ) , '' ) ) ) { if ( ! file_exists ( $ dirname ) ) { $ mkdirResult = @ mkdir ( $ dirname , 0777 , true ) ; if ( false === $ mkdirResult ) { throw new Mage_Exception ( 'Failed to create directory ' . $ dirname ) ; } } $ this -> _extractAndWriteFile ( $ header , $ currentFile ) ; $ list [ ] = $ currentFile ; } elseif ( $ header [ 'type' ] == '5' ) { if ( ! file_exists ( $ dirname ) ) { $ mkdirResult = @ mkdir ( $ currentFile , $ header [ 'mode' ] , true ) ; if ( false === $ mkdirResult ) { throw new Mage_Exception ( 'Failed to create directory ' . $ currentFile ) ; } } $ list [ ] = $ currentFile . DS ; } elseif ( $ header [ 'type' ] == '2' ) { //we do not interrupt unpack process if symlink creation failed as symlinks are not so important @ symlink ( $ header [ 'symlink' ] , $ currentFile ) ; } } return $ list ; }
Read TAR string from file, and unpacked it.
Create files and directories information about discribed
in the string.

@param string $destination path to file is unpacked
@return array list of files
@throws Mage_Exception
Read TAR string from file and unpacked it . Create files and directories information about discribed in the string .