cops/resources/epub-loader/app/action_cvs_export.php

29 lines
836 B
PHP
Raw Normal View History

<?php
/**
* Epub loader action: export ebooks info in a csv files
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Didier Corbière <didier.corbiere@opale-concept.com>
*/
2013-09-25 09:28:20 +03:00
// Init csv file
$fileName = $dbConfig['db_path'] . DIRECTORY_SEPARATOR . basename($dbConfig['db_path']) . '_metadata.csv';
try {
// Open or create the export file
$export = new BookExport($fileName, BookExport::eExportTypeCsv, true);
echo sprintf('Export ebooks to %s', $fileName) . '<br />';
// Add the epub files into the export file
if (!empty($dbConfig['epub_path'])) {
$fileList = glob($dbConfig['epub_path'] . DIRECTORY_SEPARATOR . '*.epub');
foreach ($fileList as $fileName) {
$export->AddEpub($fileName);
}
}
2013-09-25 09:28:20 +03:00
$export->SaveToFile();
}
catch (Exception $e) {
$gErrorArray[$fileName] = $e->getMessage();
}
?>