lib/magento/Archive/Tar.php
protected function _packToTar($skipRoot=false)
    {
        $file = $this->_getCurrentFile();
        $header = '';
        $data = '';
        if (!$skipRoot) {
            $header = $this->_composeHeader();
            $data = $this->_readFile($file);
            $data = str_pad($data, floor(((is_dir($file) ? 0 : filesize($file)) + 512 - 1) / 512) * 512, "\0");
        }
        $sub = '';
        if (is_dir($file)) {
            $treeDir = scandir($file);
            if (empty($treeDir)) {
                throw new Mage_Exception('Can\'t scan dir: ' . $file);
            }
            array_shift($treeDir); /* remove  './'*/
            array_shift($treeDir); /* remove  '../'*/
            foreach ($treeDir as $item) {
                $sub .= $this->_setCurrentFile($file.$item)->_packToTar(false);
            }
        }
        $tarData = $header . $data . $sub;
        $tarData = str_pad($tarData, floor((strlen($tarData) - 1) / 1536) * 1536, "\0");
        return $tarData;
    }
protected function _packToTar($skipRoot=false)
    {
        $file = $this->_getCurrentFile();
        $header = '';
        $data = '';
        if (!$skipRoot) {
            $header = $this->_composeHeader();
            $data = $this->_readFile($file);
            $data = str_pad($data, floor(((is_dir($file) ? 0 : filesize($file)) + 512 - 1) / 512) * 512, "\0");
        }
        $sub = '';
        if (is_dir($file)) {
            $treeDir = scandir($file);
            if (empty($treeDir)) {
                throw new Mage_Exception('Can\'t scan dir: ' . $file);
            }
            array_shift($treeDir); /* remove  './'*/
            array_shift($treeDir); /* remove  '../'*/
            foreach ($treeDir as $item) {
                $sub .= $this->_setCurrentFile($file.$item)->_packToTar(false);
            }
        }
        $tarData = $header . $data . $sub;
        $tarData = str_pad($tarData, floor((strlen($tarData) - 1) / 1536) * 1536, "\0");
        return $tarData;
    }
protected function _packToTar ( $ skipRoot = false ) { $ file = $ this -> _getCurrentFile ( ) ; $ header = '' ; $ data = '' ; if ( ! $ skipRoot ) { $ header = $ this -> _composeHeader ( ) ; $ data = $ this -> _readFile ( $ file ) ; $ data = str_pad ( $ data , floor ( ( ( is_dir ( $ file ) ? 0 : filesize ( $ file ) ) + 512 - 1 ) / 512 ) * 512 , "\0" ) ; } $ sub = '' ; if ( is_dir ( $ file ) ) { $ treeDir = scandir ( $ file ) ; if ( empty ( $ treeDir ) ) { throw new Mage_Exception ( 'Can\'t scan dir: ' . $ file ) ; } array_shift ( $ treeDir ) ; /* remove  './'*/ array_shift ( $ treeDir ) ; /* remove  '../'*/ foreach ( $ treeDir as $ item ) { $ sub .= $ this -> _setCurrentFile ( $ file . $ item ) -> _packToTar ( false ) ; } } $ tarData = $ header . $ data . $ sub ; $ tarData = str_pad ( $ tarData , floor ( ( strlen ( $ tarData ) - 1 ) / 1536 ) * 1536 , "\0" ) ; return $ tarData ; }
Walk through directory and add to tar file or directory.
Result is packed string on TAR format.

@deprecated after 1.7.0.0
@param boolean $skipRoot
@return string
Walk through directory and add to tar file or directory . Result is packed string on TAR format .