mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
fix #1095 : task archive crashed
This commit is contained in:
@@ -2045,6 +2045,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
|
|
||||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||||
|
|
||||||
|
if ($appbox->get_session()->get_usr_id()) {
|
||||||
$sql = 'SELECT record_id
|
$sql = 'SELECT record_id
|
||||||
FROM regroup g
|
FROM regroup g
|
||||||
INNER JOIN (record r
|
INNER JOIN (record r
|
||||||
@@ -2063,6 +2064,17 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
, ':usr_id' => $appbox->get_session()->get_usr_id()
|
, ':usr_id' => $appbox->get_session()->get_usr_id()
|
||||||
, ':record_id' => $this->get_record_id()
|
, ':record_id' => $this->get_record_id()
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
$sql = 'SELECT record_id
|
||||||
|
FROM regroup g
|
||||||
|
INNER JOIN record r
|
||||||
|
ON (g.rid_child = r.record_id AND g.rid_parent = :record_id)
|
||||||
|
ORDER BY g.ord ASC, dateadd ASC, record_id ASC';
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
':record_id' => $this->get_record_id()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$stmt = $this->get_databox()->get_connection()->prepare($sql);
|
$stmt = $this->get_databox()->get_connection()->prepare($sql);
|
||||||
$stmt->execute($params);
|
$stmt->execute($params);
|
||||||
|
@@ -1625,6 +1625,7 @@ class task_period_archive extends task_abstract
|
|||||||
$metadatasStructure = $databox->get_meta_structure();
|
$metadatasStructure = $databox->get_meta_structure();
|
||||||
|
|
||||||
$metadatas = $this->getIndexByFieldName($metadatasStructure, $media->getEntity()->getMetadatas());
|
$metadatas = $this->getIndexByFieldName($metadatasStructure, $media->getEntity()->getMetadatas());
|
||||||
|
$metaFields = null;
|
||||||
|
|
||||||
if ($captionFile !== null && true === $this->filesystem->exists($captionFile)) {
|
if ($captionFile !== null && true === $this->filesystem->exists($captionFile)) {
|
||||||
$metaFields = $this->readXMLForDatabox($metadatasStructure, $captionFile);
|
$metaFields = $this->readXMLForDatabox($metadatasStructure, $captionFile);
|
||||||
@@ -1639,8 +1640,9 @@ class task_period_archive extends task_abstract
|
|||||||
$story->substitute_subdef('document', $media);
|
$story->substitute_subdef('document', $media);
|
||||||
|
|
||||||
$story->set_metadatas($metadatas->toMetadataArray($metadatasStructure), true);
|
$story->set_metadatas($metadatas->toMetadataArray($metadatasStructure), true);
|
||||||
|
if ($metaFields) {
|
||||||
$story->set_metadatas($metaFields->toMetadataArray($metadatasStructure), true);
|
$story->set_metadatas($metaFields->toMetadataArray($metadatasStructure), true);
|
||||||
|
}
|
||||||
$story->set_binary_status(databox_status::operation_or($stat0, $stat1));
|
$story->set_binary_status(databox_status::operation_or($stat0, $stat1));
|
||||||
$story->rebuild_subdefs();
|
$story->rebuild_subdefs();
|
||||||
$story->reindex();
|
$story->reindex();
|
||||||
@@ -1690,6 +1692,7 @@ class task_period_archive extends task_abstract
|
|||||||
|
|
||||||
$metadatas = $this->getIndexByFieldName($metadatasStructure, $media->getEntity()->getMetadatas());
|
$metadatas = $this->getIndexByFieldName($metadatasStructure, $media->getEntity()->getMetadatas());
|
||||||
|
|
||||||
|
$metaFields = array();
|
||||||
if ($captionFile !== null && true === $this->filesystem->exists($captionFile)) {
|
if ($captionFile !== null && true === $this->filesystem->exists($captionFile)) {
|
||||||
$metaFields = $this->readXMLForDatabox($metadatasStructure, $captionFile);
|
$metaFields = $this->readXMLForDatabox($metadatasStructure, $captionFile);
|
||||||
$captionStatus = $this->parseStatusBit(@simplexml_load_file($captionFile));
|
$captionStatus = $this->parseStatusBit(@simplexml_load_file($captionFile));
|
||||||
|
Reference in New Issue
Block a user