XF 2.2 How can I delete unnecessary attachments?

Dkf

Active member
After restoring the forum from an old backup, it turned out that the data of the attachments in the file system and the database are different (parameter data_id). I wrote a program that solved this problem. It looked something like this -

Code:
610997-4ea286b8fcbb24f986b049a468ed9727.data - 200
610998-54f79ca91f179671e7ce8e0da17839c8.data - 200
610999-3a8fbf944694bd9c6f6e582d9fed1384.data - 200
611000-133338ef0ce55ba636177de663b0a734.data - 200
611001-edc9eec0dad0e0a00e7662cac4ab72db.data - 404, but this file is found under the name: 610968-edc9eec0dad0e0a00e7662cac4ab72db.data - 200. The file has been successfully copied and renamed.
611002-7a7719cede47cf280f16bde68f3c1acf.data - 404, but this file is found under the name: 610969-7a7719cede47cf280f16bde68f3c1acf.data - 200. The file has been successfully copied and renamed.
611003-33e9dd48fe80d8a51afd11bfdb7abbd6.data - 404, but this file is found under the name: 610970-33e9dd48fe80d8a51afd11bfdb7abbd6.data - 200. The file has been successfully copied and renamed.
611004-2c513cadda346c6d33f4f99ef458d6f6.data - 404, but this file is found under the name: 610971-2c513cadda346c6d33f4f99ef458d6f6.data - 200. The file has been successfully copied and renamed.
611005-39d218f528e4d35a116dbd1927bc9804.data - 404, but this file is found under the name: 610972-39d218f528e4d35a116dbd1927bc9804.data - 200. The file has been successfully copied and renamed.
611007-2afc71792d880522de426ba8cf7fd614.data - 404, but this file is found under the name: 610974-2afc71792d880522de426ba8cf7fd614.data - 200. The file has been successfully copied and renamed.
611008-f506e9f647d0485c6ac68fc071b7aef1.data - 404, but this file is found under the name: 610975-f506e9f647d0485c6ac68fc071b7aef1.data - 200. The file has been successfully copied and renamed.
611009-9b98b53212b4b01f9ca46b7ced8c90e3.data - 404, but this file is found under the name: 610976-9b98b53212b4b01f9ca46b7ced8c90e3.data - 200. The file has been successfully copied and renamed.

After that, the number of attachments increased by about 50%. How can I delete the unnecessary ones? Is there a system function or plugin for this?
 
And... Thanks to XenForo for properly formatting filenames, including a hash in the name, and ensuring the dependency between folder names and files.
This helped in recovering the content
 
XF\Cron\CleanUp::runHourlyCleanUp()

How does this function work?

Will it delete one of these two files?

611001-edc9eec0dad0e0a00e7662cac4ab72db.data and
610001-62cac4ab72db62cac4ab72db.data62ca.data
 
Last edited:
Top Bottom