osTicket Version v1.12.3
Web Server Software Apache/2.4.6 (CentOS) PHP/7.3.5
MySQL Version 5.5.60
PHP Version 7.3.5
I'm attempting to write a simple cron script that will delete all old attachments.
I believe I have to delete content from the following tables:
ostjobs_file
ostjobs_file_chunk
ostjobs_attachment
Q1 = SELECT
idFROM
ostjobs_fileWHERE
created< NOW() - INTERVAL 18 MONTH order by id
This will get me all tickets which are older than 18 months and candidates for deletion.
How do I identify the corresponding records from the other 2 tables:
ostjobs_attachment
idint(10) unsigned NOT NULL AUTO_INCREMENT,
object_idint(11) unsigned NOT NULL,
typechar(1) NOT NULL,
file_idint(11) unsigned NOT NULL,
namevarchar(255) DEFAULT NULL,
inlinetinyint(1) unsigned NOT NULL DEFAULT '0',
langvarchar(16) DEFAULT NULL,
PRIMARY KEY (
id),
ostjobs_file_chunk
file_idint(11) NOT NULL,
chunk_idint(11) NOT NULL,
filedatalongblob NOT NULL,
Are there any other tables I should delete records from ?
Thanks~