function exportAction()
 {
     $this->checkVersion();
     if (isset($_REQUEST['go'])) {
         if (isset($_REQUEST['format']) && 'csv' == $_REQUEST['format']) {
             header(sprintf('Content-Disposition: attachment;filename="vaf-export-%s.csv"', time()));
             $stream = fopen("php://output", 'w');
             $sitemap = new Elite_Vafsitemap_Model_Sitemap_Product_GoogleBase($this->config());
             $sitemap->csv($_GET['store'], $stream);
             exit;
         } else {
             $sitemap = new Elite_Vafsitemap_Model_Sitemap_Product_XML($this->config());
             $size = $sitemap->productCount();
             $files = array();
             $chunkSize = 50000;
             $basePath = Mage::getBaseDir() . '/var/vaf-sitemap-xml';
             if (file_exists($basePath)) {
                 $this->recursiveDelete($basePath);
             }
             mkdir($basePath);
             for ($i = 0; $i <= $size; $i += $chunkSize) {
                 $xml = $sitemap->xml($_GET['store'], $i == 0 ? 0 : $i + 1, $i + $chunkSize);
                 $file = $basePath . '/' . floor($i / $chunkSize) . '.xml';
                 array_push($files, basename($file));
                 file_put_contents($file, $xml);
             }
             file_put_contents($basePath . '/sitemap-index.xml', $sitemap->sitemapIndex($files));
             echo 'Sitemap created to ' . $basePath;
             exit;
         }
     }
     $this->loadLayout();
     $this->_setActiveMenu('vaf/export');
     $block = $this->getLayout()->createBlock('adminhtml/template', 'vafsitemap_export')->setTemplate('vf/vafsitemap/export.phtml');
     $this->_addContent($block);
     $this->renderLayout();
 }