fix #1095 : task archive crashed

This commit is contained in:
jygaulier
2013-02-12 16:23:28 +01:00
parent afd3c8bbdc
commit 4f7be4e207
2 changed files with 23 additions and 8 deletions

View File

@@ -1625,6 +1625,7 @@ class task_period_archive extends task_abstract
$metadatasStructure = $databox->get_meta_structure();
$metadatas = $this->getIndexByFieldName($metadatasStructure, $media->getEntity()->getMetadatas());
$metaFields = null;
if ($captionFile !== null && true === $this->filesystem->exists($captionFile)) {
$metaFields = $this->readXMLForDatabox($metadatasStructure, $captionFile);
@@ -1639,8 +1640,9 @@ class task_period_archive extends task_abstract
$story->substitute_subdef('document', $media);
$story->set_metadatas($metadatas->toMetadataArray($metadatasStructure), true);
$story->set_metadatas($metaFields->toMetadataArray($metadatasStructure), true);
if ($metaFields) {
$story->set_metadatas($metaFields->toMetadataArray($metadatasStructure), true);
}
$story->set_binary_status(databox_status::operation_or($stat0, $stat1));
$story->rebuild_subdefs();
$story->reindex();
@@ -1690,6 +1692,7 @@ class task_period_archive extends task_abstract
$metadatas = $this->getIndexByFieldName($metadatasStructure, $media->getEntity()->getMetadatas());
$metaFields = array();
if ($captionFile !== null && true === $this->filesystem->exists($captionFile)) {
$metaFields = $this->readXMLForDatabox($metadatasStructure, $captionFile);
$captionStatus = $this->parseStatusBit(@simplexml_load_file($captionFile));