20 public static function increaseDirCounter($mailboxId, $dirForMoveMessages =
false, $dirForMoveMessagesId, $idsUnseenCount)
22 if(!is_null($dirForMoveMessages) && $dirForMoveMessages ===
false || !$dirForMoveMessages->isInvisibleToCounters()){
24 '=MAILBOX_ID' => $mailboxId,
25 '=ENTITY_TYPE' =>
'DIR',
26 '=ENTITY_ID' => $dirForMoveMessagesId
32 'MAILBOX_ID' => $mailboxId,
33 'ENTITY_TYPE' =>
'DIR',
34 'ENTITY_ID' => $dirForMoveMessagesId
44 'MAILBOX_ID' => $mailboxId,
45 'ENTITY_TYPE' =>
'DIR',
46 'ENTITY_ID' => $dirForMoveMessagesId
49 "VALUE" => $idsUnseenCount,
57 if($dirWithMessagesId)
60 '=MAILBOX_ID' => $mailboxId,
61 '=ENTITY_TYPE' =>
'DIR',
62 '=ENTITY_ID' => $dirWithMessagesId,
63 '>=VALUE' => $idsUnseenCount
68 'MAILBOX_ID' => $mailboxId,
69 'ENTITY_TYPE' =>
'DIR',
70 'ENTITY_ID' => $dirWithMessagesId
82 $dirWithMessagesId = MailboxDirectoryTable::getList([
86 'Bitrix\Mail\MailMessageUidTable',
88 '=this.DIR_MD5' =>
'ref.DIR_MD5',
89 '=this.MAILBOX_ID' =>
'ref.MAILBOX_ID',
92 'join_type' =>
'INNER',
100 '@UID.ID' => $messagesIds,
101 '=MAILBOX_ID' => $mailboxId,
106 if(isset($dirWithMessagesId[0][
'ID']))
108 return $dirWithMessagesId[0][
'ID'];
121 if (!empty($mailboxOptions[
'imap'][
'dirsMd5']))
123 $names = array_filter(
124 $mailboxOptions[
'imap'][
'dirsMd5'],
125 function ($hash) use ($messageFolderHash)
127 return $hash == $messageFolderHash;
130 if (count($names) == 1)
132 $folderName = array_keys($names)[0];
141 if (!empty($mailboxOptions[
'imap'][
'dirsMd5']))
143 $name = static::getFolderNameByType($folderType, $mailboxOptions);
144 $hashes = array_filter(
145 $mailboxOptions[
'imap'][
'dirsMd5'],
146 function ($_name) use ($name)
148 return $_name == $name;
152 if (count($hashes) == 1)
154 $folderHash = array_values($hashes)[0];
163 if (!empty($mailboxOptions[
'imap']) && is_array($mailboxOptions[
'imap']))
165 $imapOptions = $mailboxOptions[
'imap'];
166 if (!empty($imapOptions[$folderType]) && isset($imapOptions[$folderType][0]))
168 return $imapOptions[$folderType][0];
176 $disabled = empty($mailboxOptions[
'imap'][
'disabled']) ? [] : $mailboxOptions[
'imap'][
'disabled'];
177 $ignore = empty($mailboxOptions[
'imap'][
'ignore']) ? [] : $mailboxOptions[
'imap'][
'ignore'];
178 return array_merge($disabled, $ignore);
183 return in_array($folder, static::getDisabledFolders($mailboxOptions),
true);
188 $root = array_shift($path);
190 if (mb_strtolower($root) ==
'inbox' && !static::isDisabledFolder($root, $mailboxOptions))
195 array_unshift($path, $root);
202 $path = static::getFormattedPath($path, $mailboxOptions);
204 return $full ? join(
' / ', $path) : end($path);
static getFolderNameByType($folderType, $mailboxOptions)
static getFolderHashByType($folderType, $mailboxOptions)
static getFormattedPath(array $path, $mailboxOptions)
static getDisabledFolders($mailboxOptions)
static isDisabledFolder($folder, $mailboxOptions)
static decreaseDirCounter($mailboxId, $dirWithMessagesId, $idsUnseenCount)
static getFormattedName(array $path, $mailboxOptions, $full=true)
static getFolderNameByHash($messageFolderHash, $mailboxOptions)
static getDirIdForMessages($mailboxId, $messagesIds)
static increaseDirCounter($mailboxId, $dirForMoveMessages=false, $dirForMoveMessagesId, $idsUnseenCount)
static getMessage($code, $replace=null, $language=null)
static getCount($filter=array(), array $cache=array())
static update($primary, array $data)