-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix email collector datetimelast ok and email fetching #32456
base: develop
Are you sure you want to change the base?
Conversation
@@ -1690,7 +1691,7 @@ public function doCollectOneCollector($mode = 0) | |||
if ($mode > 0) { | |||
$Query->leaveUnread(); | |||
} | |||
$arrayofemail = $Query->limit($this->maxemailpercollect)->setFetchOrder("asc")->get(); | |||
$arrayofemail = $Query->limit($this->maxemailpercollect)->setFetchOrder("desc")->get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We must keep the order "asc" because we must process the email from the older one to the new one. In same order than they are received.
Does the fix change if we restore "asc" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes as said in the description if we set setFetchOrder as asc the mail are not proceed the same way.
For exmple we want 2 mails to be proceed in a mail chain of 10 mails sent
- if we keep asc, the last 2 mails of the chain mail are proceed first because in this case 'asc' means we start at the end of the mail inbox
- if we set to desc, the 2 first mails are proceed because desc means we start from top of inbox.
And if we proceed the 10 emails of the mail chain then if we set desc or asc is the same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange. I have got the opposite :
I have 1 email on 19 dec and another one of 20 dec.
If i set limit to 10, the result is the same, i agree.
But if i set limit to 1, i get the email of the 19 dec when sort is asc, and i get the 20 dec if sort is asc.
So on my side, I need asc.
According to this Webklex/php-imap#71, the sort is to define which bloc to receive when the limit is spliting the result into several blocks. According to exemple in this issue, when whe use the sort desc, we got the last recent block. And we want the older block.
So my result matches the explanation and the example of weklex. If max limit is higher than the number of results, then the sort has no effect. But if the max limit is lower, then we should use asc to get the block that is lower so older emails (the date that is the lower).
What weblex and its example says is that, inside a bloc, the sorting is always asc (great this is what we want), so trouble is only to get the oldest bloc when number of record is higher than limit.
And according to tests done with a block of 1, 'asc' means the last ancient block when there is several blocks.
We may contact each other later to make test on a real environment to see why you got a different behaviour...
Fix a bug where email collector does not update datelastok to the last email date when there are still some email to get.
Fix a bug where email was fetch in the bad order which make a broken timeline if a email chain is bigger then the number of mail to fetch