Moodle

Reset: Forum reset in the Course reset page

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.7.1, 1.7.2, 1.7.3, 1.9
  • Fix Version/s: 1.8.4, 1.9, 2.0
  • Component/s: Forum
  • Labels:
    None
  • Affected Branches:
    MOODLE_17_STABLE, MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE

Description

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.

Issue Links

Activity

Hide
Petr Kalis added a comment -

See patch against 1.9 attached

Show
Petr Kalis added a comment - See patch against 1.9 attached
Hide
Mawuli Kuivi added a comment -

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.

Show
Mawuli Kuivi added a comment - 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.
Hide
Petr Kalis added a comment -

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

Show
Petr Kalis added a comment - 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
Hide
Mawuli Kuivi added a comment -

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.

Show
Mawuli Kuivi added a comment - 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.
Hide
Yu Zhang added a comment -

Thanks Petr, have checked this in.

Show
Yu Zhang added a comment - Thanks Petr, have checked this in.
Hide
Petr Kalis added a comment -

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.

Show
Petr Kalis added a comment - 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.
Hide
Petr Škoda (skodak) added a comment -

I fixed that too in my patch, it should be ready for wider testing tomorrow (1.9/head only).

Show
Petr Škoda (skodak) added a comment - I fixed that too in my patch, it should be ready for wider testing tomorrow (1.9/head only).
Hide
Mawuli Kuivi added a comment -

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?

Show
Mawuli Kuivi added a comment - 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?

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: