Deletion of forum attachment does not remove linked file
- Status
- Closed
- Subject
- Deletion of forum attachment does not remove linked file
- Version
- 1.9.x
- Category
- Error
- Feature
- Forum
- Resolution status
- Fixed or Solved
- Submitted by
- Nelson Ko
- Lastmod by
- pkdille
- Rating
- Description
As described in title. Problem exists when forum attachments are stored in linked files (vs. database)
Something should be done also for case where forum topic or thread is deleted. function remove_comment($threadId) does not do this either.
Problem is that the following function in commentslib.php does not delete linked file
function remove_thread_attachment($attId) {
232 $query = "delete from `tiki_forum_attachments` where `attId`=?";
233
234 $this->query($query,array($attId));
235 }- Solution
Possible solution:
function remove_thread_attachment($attId) {
$path = $this->getOne("select `path` from `tiki_forum_attachments` where `attId`=$attId");
$dir = $this->getOne("select `dir` from `tiki_forum_attachments` where `attId`=$attId");if ($path) {
@unlink ($dir . $path);
}$query = "delete from `tiki_forum_attachments` where `attId`=?";
$this->query($query,array($attId));
}Tested on 2008-10-11 on tiki 3.0. Fixed
- Importance
- 7
- Priority
- 35
- Demonstrate Bug on Tiki 19+
-
This bug has been demonstrated on show2.tiki.org
Please demonstrate your bug on show2.tiki.org
Show.tiki.org is not configured properlyThe public/private keys configured to connect to show2.tiki.org were not accepted. Please make sure you are using RSA keys. Thanks.
- Demonstrate Bug (older Tiki versions)
-
This bug has been demonstrated on show.tikiwiki.org
Please demonstrate your bug on show.tikiwiki.org
Show.tiki.org is not configured properlyThe public/private keys configured to connect to show.tikiwiki.org were not accepted. Please make sure you are using RSA keys. Thanks.
- Ticket ID
- 926
- Created
- Tuesday 31 October, 2006 15:41:44 UTC
by Unknown - LastModif
- Saturday 11 October, 2008 05:46:02 UTC