lib/magento/Archive/Tar.php
protected function _createTar($skipRoot = false, $finalize = false)
    {
        if (!$skipRoot) {
            $this->_packAndWriteCurrentFile();
        }

        $file = $this->_getCurrentFile();

        if (is_dir($file)) {
            $dirFiles = scandir($file);

            if (false === $dirFiles) {
                throw new Mage_Exception('Can\'t scan dir: ' . $file);
            }

            array_shift($dirFiles); /* remove  './'*/
            array_shift($dirFiles); /* remove  '../'*/

            foreach ($dirFiles as $item) {
                $this->_setCurrentFile($file . $item)->_createTar();
            }
        }

        if ($finalize) {
            $this->_getWriter()->write(str_repeat("\0", self::TAR_BLOCK_SIZE * 12));
        }
    }
protected function _createTar($skipRoot = false, $finalize = false)
    {
        if (!$skipRoot) {
            $this->_packAndWriteCurrentFile();
        }

        $file = $this->_getCurrentFile();

        if (is_dir($file)) {
            $dirFiles = scandir($file);

            if (false === $dirFiles) {
                throw new Mage_Exception('Can\'t scan dir: ' . $file);
            }

            array_shift($dirFiles); /* remove  './'*/
            array_shift($dirFiles); /* remove  '../'*/

            foreach ($dirFiles as $item) {
                $this->_setCurrentFile($file . $item)->_createTar();
            }
        }

        if ($finalize) {
            $this->_getWriter()->write(str_repeat("\0", self::TAR_BLOCK_SIZE * 12));
        }
    }
protected function _createTar ( $ skipRoot = false , $ finalize = false ) { if ( ! $ skipRoot ) { $ this -> _packAndWriteCurrentFile ( ) ; } $ file = $ this -> _getCurrentFile ( ) ; if ( is_dir ( $ file ) ) { $ dirFiles = scandir ( $ file ) ; if ( false === $ dirFiles ) { throw new Mage_Exception ( 'Can\'t scan dir: ' . $ file ) ; } array_shift ( $ dirFiles ) ; /* remove  './'*/ array_shift ( $ dirFiles ) ; /* remove  '../'*/ foreach ( $ dirFiles as $ item ) { $ this -> _setCurrentFile ( $ file . $ item ) -> _createTar ( ) ; } } if ( $ finalize ) { $ this -> _getWriter ( ) -> write ( str_repeat ( "\0" , self :: TAR_BLOCK_SIZE * 12 ) ) ; } }
Recursively walk through file tree and create tarball

@param boolean $skipRoot
@param boolean $finalize
@throws Mage_Exception
Recursively walk through file tree and create tarball