return map;
}
+static void mdbox_map_deinit_cleanup(struct mdbox_map *map)
+{
+ if (map->view == NULL)
+ return;
+
+ const struct mail_index_header *hdr =
+ mail_index_get_header(map->view);
+ if (dbox_mailbox_list_cleanup(map->root_list, map->path,
+ hdr->last_temp_file_scan) > 0)
+ index_mailbox_view_update_last_temp_file_scan(map->view);
+}
+
void mdbox_map_deinit(struct mdbox_map **_map)
{
struct mdbox_map *map = *_map;
*_map = NULL;
+ mdbox_map_deinit_cleanup(map);
if (map->view != NULL) {
mail_index_view_close(&map->view);
mail_index_close(map->index);
return 0;
}
-static void mdbox_map_cleanup(struct mdbox_map *map)
-{
- unsigned int interval =
- MAP_STORAGE(map)->set->mail_temp_scan_interval;
- struct stat st;
-
- if (stat(map->path, &st) < 0)
- return;
-
- /* check once in a while if there are temp files to clean up */
- if (interval == 0) {
- /* disabled */
- } else if (st.st_atime > st.st_ctime + DBOX_TMP_DELETE_SECS) {
- /* there haven't been any changes to this directory since we
- last checked it. */
- } else if (st.st_atime < ioloop_time - (time_t)interval) {
- /* time to scan */
- (void)unlink_old_files(map->path, DBOX_TEMP_FILE_PREFIX,
- ioloop_time - DBOX_TMP_DELETE_SECS);
- }
-}
-
static int mdbox_map_open_internal(struct mdbox_map *map, bool create_missing)
{
enum mail_index_open_flags open_flags;
}
map->view = mail_index_view_open(map->index);
- mdbox_map_cleanup(map);
if (mail_index_get_header(map->view)->uid_validity == 0) {
if (mdbox_map_generate_uid_validity(map) < 0) {