跳至内容
菜单
此问题已终结
3 回复
16701 查看

I've started to use Maintenance module and noticed that files in filestore directory are not removed after deleting attachments. Is any simple method to make a cleanup of unused files or I need to write a script which will be doing it?

 I know, that using hash of files instead of real names is useful when the same files are attached many times and therefore is not so easy to delete file directly after removing attachment but I hope a cron script would be very desired.

Odoo v.11


形象
丢弃
编写者 最佳答案

Self-answer. I found that Odoo makes such cleanup  automatically (in my instalation twice a day) then described problem does not exist. A few houres later filestore directory was freed from unnecessary files.

Odoo v. 12 not 11 as noticed in previous post.

形象
丢弃
最佳答案

Just to fill inn what I found out. The job that does this is called

Base: Auto-vacuum internal data

and lives here:


class AutoVacuum(models.AbstractModel):
""" Expose the vacuum method to the cron jobs mechanism. """
_name = 'ir.autovacuum'
_description = 'Automatic Vacuum'
.
.
.
@api.model
def power_on(self, *args, **kwargs):
if not self.env.user._is_admin():
raise AccessDenied()
self.env['ir.attachment']._file_gc()
self._gc_transient_models()
self._gc_user_logs()
return True
形象
丢弃
最佳答案

Hi

I actually have a interesting case. I currently run v15 on odoo.sh and I'm exporting database to try to import it with filestore to different machine for testing and I get 'virus' warning on some file in the odoo db dump.

I was able to locate the phisical file with it's name from antivirus and tried to search for the file in ir.attachment table using the field "Stored Filename" (technical name of field 'store_fname'). Result is the file name that is physically in database dump is not found in the ir.attachment, but the file is physically in the filestore folder when doing db backup.

This is where it gets interesting... in pararel I'm tring to migrate to v17 and have my staging running with v17 version with the same database backup, and there I can find the file in ir.attachment based on it's "Stored Filename".

I want to remove the file from v15 to continue migration, but I cannot locate it.

any ideas?

形象
丢弃
相关帖文 回复 查看 活动
0
1月 21
7355
1
12月 17
8020
1
2月 25
891
5
10月 24
10029
0
7月 24
702