Issue Details (XML | Word | Printable)

Key: MDL-12175
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Yu Zhang
Reporter: Mawuli Kuivi
Votes: 0
Watchers: 2
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Reset: Forum reset in the Course reset page

Created: 15/Nov/07 03:17 AM   Updated: 10/Jan/08 01:48 AM
Return to search
Component/s: Forum
Affects Version/s: 1.7.1, 1.7.2, 1.7.3, 1.9
Fix Version/s: 1.8.4, 1.9, 2.0

File Attachments: 1. Text File lib.php.patch (4 kB)

Issue Links:
Dependency
 

Participants: Mawuli Kuivi, Petr Kalis, Petr Skoda and Yu Zhang
Security Level: None
Resolved date: 26/Nov/07
Affected Branches: MOODLE_17_STABLE, MOODLE_19_STABLE
Fixed Branches: MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE


 Description  « Hide
When you are resetting a course, and select to reset the forum, it does not remove file attachments to a post. Only removed the post and the file remain on the server.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Petr Kalis added a comment - 21/Nov/07 07:45 PM
See patch against 1.9 attached

Mawuli Kuivi added a comment - 22/Nov/07 03:53 AM
Thanks for doing this.
I see a problem with this patch.

In each of the if statements, you get a new $postsarr value.

For example,
-----------
if (!empty($data->reset_forum_single)) {
....
$postsarr = ...
...
}

If the value of $postsarr is set in the first if statment and you are calling it again in another if statment, the first values get removed. You need to be merging them so that you have all the values from all the if statements.

The way it is now, only the values from the last if statement is retained. The rest gets lost. Hope l am making sense to you.


Petr Kalis added a comment - 22/Nov/07 04:14 AM
Hi
You are making perfectly sense, still you are wrong, imho .
I am sending already selected posts with attachments to
function forum_get_posts_with_attachments
and in this function i am doing your mentioned merging
return array_merge((array)$postsarr,$records);

I think this way it is deleting all posts with attachments (only first post of single simple discussion stays, but this was earlier too, so i thought its feature ) from different forums. But i welcome any betatesters


Mawuli Kuivi added a comment - 22/Nov/07 04:25 AM
I see what you are doing.

You are doing the merge in the forum_get_posts_with_attachments function. I did not see that at first. That should work just fine.

Thanks again.


Yu Zhang added a comment - 26/Nov/07 12:24 PM
Thanks Petr, have checked this in.

Petr Kalis added a comment - 26/Nov/07 04:17 PM
Thanks Yu for checking this in.
But i found another problem in resetting forums. It lefts discussions in the database (posts are deleted ok, discussions not, they are orphaned and left in the DB). I will check if there is a issue for this and try to solve it.

Petr Skoda added a comment - 26/Nov/07 07:46 PM
I fixed that too in my patch, it should be ready for wider testing tomorrow (1.9/head only).

Mawuli Kuivi added a comment - 10/Jan/08 01:48 AM
I just downloaded the 1.7.3 built of today (Wed Jan 9 2008). I did not see this fix in the tar file.

Which it be in?