Epub loader:
Add Cops feed loader Typo: Change cvs_export to csv_export Rename config.php file to epub-loader-config.php Config: Add app_name, admin_email
This commit is contained in:
parent
fce60d4079
commit
35bbf55e19
7 changed files with 56 additions and 26 deletions
31
resources/epub-loader/app/action_csv_export.php
Normal file
31
resources/epub-loader/app/action_csv_export.php
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
/**
|
||||
* Epub loader application 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>
|
||||
*/
|
||||
|
||||
// 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 = RecursiveGlob($dbConfig['epub_path'], '*.epub');
|
||||
foreach ($fileList as $fileName) {
|
||||
$error = $export->AddEpub($fileName);
|
||||
if (!empty($error)) {
|
||||
$gErrorArray[$fileName] = $error;
|
||||
}
|
||||
}
|
||||
}
|
||||
$export->SaveToFile();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$gErrorArray[$fileName] = $e->getMessage();
|
||||
}
|
||||
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue