2013-09-25 04:03:52 +03:00
|
|
|
<?php
|
|
|
|
/**
|
2013-10-01 00:29:27 +03:00
|
|
|
* Epub loader application action: export ebooks info in a csv files
|
2013-09-25 04:03:52 +03:00
|
|
|
*
|
|
|
|
* @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'])) {
|
2013-10-08 01:00:06 +03:00
|
|
|
$fileList = RecursiveGlob($dbConfig['epub_path'], '*.epub');
|
2013-09-25 09:28:20 +03:00
|
|
|
foreach ($fileList as $fileName) {
|
2013-10-10 03:16:43 +03:00
|
|
|
$error = $export->AddEpub($fileName);
|
|
|
|
if (!empty($error)) {
|
|
|
|
$gErrorArray[$fileName] = $error;
|
|
|
|
}
|
2013-09-25 04:03:52 +03:00
|
|
|
}
|
|
|
|
}
|
2013-09-25 09:28:20 +03:00
|
|
|
$export->SaveToFile();
|
|
|
|
}
|
|
|
|
catch (Exception $e) {
|
|
|
|
$gErrorArray[$fileName] = $e->getMessage();
|
2013-09-25 04:03:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|