Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[F] Orphaned attachment deletion [C-Imad Jomaa]
The orphaned attachments search finds attachments that were uploaded over 24 hours ago but not attached to a post. In this case there's a file in the uploads folder and an entry in the database. If you delete such an attachment the file remains on the server (It is found in a second search though because of the missing database entry).

The reason can be found in the file inc/functions_upload.php in the functions remove_attachment() and remove_attachments():
$mybb->settings['uploadspath'] by default is set to ./uploads. If you call the function from the ACP it tries to delete the file in ROOT/admin/uploads/.

A solution would be to use MYBB_ROOT or to differ like it is done in the function remove_avatars():
    $avatarpath = '../'.$mybb->settings['avataruploadpath'];
    $avatarpath = $mybb->settings['avataruploadpath'];
[Image: donation_drive_sig.png]

Messages In This Thread
[F] Orphaned attachment deletion [C-Imad Jomaa] - by Michael S. - 2009-03-27, 12:56 AM
[F] Orphaned attachment deletion - by Ryan Gordon - 2009-03-30, 12:34 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)