Commit f8f3279c authored by patrick-proulx's avatar patrick-proulx

[FIX] Fixed fatal error with indexing if referenced file no longer exists (eg...

[FIX] Fixed fatal error with indexing if referenced file no longer exists (eg deleted outside of Tiki). Trigger warning in logs instead.
parent 25714396
......@@ -36,11 +36,13 @@ class Search_GlobalSource_ArticleAttachmentSource implements Search_GlobalSource
foreach ($relations as $rel) {
if ($rel['type'] == 'article') {
$data = $this->source->getDocument($rel['itemId'], $typeFactory);
foreach ($this->source->getGlobalFields() as $name => $keep) {
$textual[] = $data[$name]->getValue();
}
if ($data = $this->source->getDocument($rel['itemId'], $typeFactory)){
foreach ($this->source->getGlobalFields() as $name => $keep) {
$textual[] = $data[$name]->getValue();
}
} else {
error_log("File " . $rel['itemId'] . ", referenced from " . $objectType . $objectId . " no longer exists.");
}
}
}
......
......@@ -41,11 +41,13 @@ class Search_GlobalSource_FileAttachmentSource implements Search_GlobalSource_In
foreach ($relations as $rel) {
if ($rel['type'] == 'file') {
$files[] = $rel['itemId'];
$data = $this->fileSource->getDocument($rel['itemId'], $typeFactory);
foreach ($this->fileSource->getGlobalFields() as $name => $keep) {
$textual[] = $data[$name]->getValue();
}
if ($data = $this->fileSource->getDocument($rel['itemId'], $typeFactory)) {
foreach ($this->fileSource->getGlobalFields() as $name => $keep) {
$textual[] = $data[$name]->getValue();
}
} else {
error_log("File " . $rel['itemId'] . ", referenced from " . $objectType . $objectId . " no longer exists.");
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment