Fix mail import
This commit is contained in:
parent
e3584daef9
commit
8c2f91573a
|
@ -389,7 +389,7 @@ class OnePoll
|
||||||
// Have we seen it before?
|
// Have we seen it before?
|
||||||
$fields = ['deleted', 'id'];
|
$fields = ['deleted', 'id'];
|
||||||
$condition = ['uid' => $importer_uid, 'uri' => $datarray['uri']];
|
$condition = ['uid' => $importer_uid, 'uri' => $datarray['uri']];
|
||||||
$item = dba::selectFirst('item', $fields, $condition);
|
$item = Item::selectFirst($fields, $condition);
|
||||||
if (DBM::is_result($item)) {
|
if (DBM::is_result($item)) {
|
||||||
logger("Mail: Seen before ".$msg_uid." for ".$mailconf['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],LOGGER_DEBUG);
|
logger("Mail: Seen before ".$msg_uid." for ".$mailconf['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],LOGGER_DEBUG);
|
||||||
|
|
||||||
|
@ -435,13 +435,17 @@ class OnePoll
|
||||||
$refs_arr = explode(' ', $raw_refs);
|
$refs_arr = explode(' ', $raw_refs);
|
||||||
if (count($refs_arr)) {
|
if (count($refs_arr)) {
|
||||||
for ($x = 0; $x < count($refs_arr); $x ++) {
|
for ($x = 0; $x < count($refs_arr); $x ++) {
|
||||||
$refs_arr[$x] = "'" . Email::msgid2iri(str_replace(['<', '>', ' '],['', '', ''],dbesc($refs_arr[$x]))) . "'";
|
// $refs_arr[$x] = "'" . Email::msgid2iri(str_replace(['<', '>', ' '],['', '', ''],dbesc($refs_arr[$x]))) . "'";
|
||||||
|
$refs_arr[$x] = Email::msgid2iri(str_replace(['<', '>', ' '],['', '', ''], $refs_arr[$x]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$condition = ['uri' => $refs_arr, 'uid' => $importer_uid];
|
$condition = ['uri' => $refs_arr, 'uid' => $importer_uid];
|
||||||
$parent = Item::selectFirst(['parent-uri'], $condition);
|
$parent = Item::selectFirst(['parent-uri'], $condition);
|
||||||
if (DBM::is_result($parent)) {
|
if (DBM::is_result($parent)) {
|
||||||
|
logger('Parent found with matching uri. ' . json_encode($refs_arr), LOGGER_DEBUG);
|
||||||
$datarray['parent-uri'] = $parent['parent-uri']; // Set the parent as the top-level item
|
$datarray['parent-uri'] = $parent['parent-uri']; // Set the parent as the top-level item
|
||||||
|
} else {
|
||||||
|
logger('No parent found with matching uri. ' . json_encode($refs_arr), LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,7 +478,10 @@ class OnePoll
|
||||||
$params = ['order' => ['created' => true]];
|
$params = ['order' => ['created' => true]];
|
||||||
$parent = Item::selectFirst(['parent-uri'], $condition, $params);
|
$parent = Item::selectFirst(['parent-uri'], $condition, $params);
|
||||||
if (DBM::is_result($parent)) {
|
if (DBM::is_result($parent)) {
|
||||||
|
logger('Parent found with matching title. ' . $datarray['title'], LOGGER_DEBUG);
|
||||||
$datarray['parent-uri'] = $parent['parent-uri'];
|
$datarray['parent-uri'] = $parent['parent-uri'];
|
||||||
|
} else {
|
||||||
|
logger('No parent found with matching title. ' . $datarray['title'], LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user