Issue Details (XML | Word | Printable)

Key: MDL-2674
Type: Sub-task Sub-task
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Helen Foster
Reporter: Penny Leach
Votes: 7
Watchers: 6
Operations

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

backup always backsup/restores groups regardless of user settings

Created: 04/Mar/05 09:23 AM   Updated: 03/Oct/09 02:16 AM
Return to search
Component/s: Backup, Groups
Affects Version/s: 1.5.2, 1.9
Fix Version/s: 1.9.1

File Attachments: 1. File patch-Bug-3132-group-backup-option-7core.diff (14 kB)
2. File patch-Bug-3132-group-backup-option-8core.diff (16 kB)

Environment: All
Issue Links:
Duplicate
 
Relates
 

Database: Any
Participants: David Mudrak, Eloy Lafuente (stronk7), Helen Foster, Martin Dougiamas, Nick Freear, Penny Leach, Petr Skoda and Timothy Takemoto
Security Level: None
QA Assignee: Eloy Lafuente (stronk7)
Resolved date: 21/Mar/08
Affected Branches: MOODLE_15_STABLE, MOODLE_19_STABLE
Fixed Branches: MOODLE_19_STABLE


 Description  « Hide
It seems to me that backup and restore will always include groups and group memberships, regardless of whether user info is selected or not.

I think the correct behaviour would be to always backup/restore group names, but only backup/restore the group memberships if user info has been selected.

Thoughts?

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Martin Dougiamas added a comment - 03/May/06 03:48 AM
From (penny at catalyst.net.nz) Friday, 4 March 2005, 09:33 AM:

Also, perhaps there should actually be a setting for groups names.

In looking at the code it seems like scales and events always get backed up/restored without asking for a preference as well.

From (penny at catalyst.net.nz) Friday, 4 March 2005, 12:28 PM:

Also, group images don't seem to be backed up/restored?

From Eloy Lafuente (stronk7 at moodle.org) Saturday, 5 March 2005, 08:54 AM:

Groups are always saved but group members only if you select to backup users.

Only used scales (course_scale_used() function) are included automatically, and course events too. Here it's an ordered list of my opinions:

1-Having a setting for groups could be a nightmare because modules running under groups in the original course have to be modified to take care of this setting to delete their group info (and group mode). It's possible to implement it but perhaps it's too late for 1.5...

2-About groups too, yes, images should be included in backup and restore! I've added it to my todo list (backup/CHANGES_14_15.txt). My fault!

3-Having a setting for scales it's really a wrong idea and I think that the current approach (export used scales) is the correct one. We can, anyway, improve it a bit to detect only scales used by modules being exported (currently all scales in any module in the course are being included). This involves creating a new function in backup/lib.php called backup_scale_used() really similar to the course based but skipping not selected modules. For 1.5?

4.-And finally, events. A setting for this could be really nice and easy to implement. As such info in not related to the rest of the backup (like groups or scales) having a check to decide it is really a good idea. For 1.5?

Ciao

From (penny at catalyst.net.nz) Monday, 7 March 2005, 04:29 AM:

Sorry, my bad, I just did cvs annotate on restorelib.php and saw that the check for backup->users for group members was added after our last merge. Should have checked that before posting the bug report.

From Eloy Lafuente (stronk7 at moodle.org) Tuesday, 8 March 2005, 01:38 AM:

NP!

Anyway, we have to decide about points 3 and 4 (Martin D added to the discussion).

Are my theories correct? Must I include them in my CHANGES_14_15 list?

Ciao

From (penny at catalyst.net.nz) Thursday, 10 March 2005, 04:18 AM:

> 1-Having a setting for groups could be a nightmare because modules running

> under groups in the original course have to be modified to take care of this

> setting to delete their group info (and group mode). It's possible to implement it

> but perhaps it's too late for 1.5...

I agree that it would be a nightmare, because of all the modules and how they work with groups. Maybe for 1.6? I mean, I'd love it for 1.5 but it may be unrealistic.

> 3-Having a setting for scales it's really a wrong idea and I think that the current

> approach (export used scales) is the correct one. We can, anyway, improve it a bit

> to detect only scales used by modules being exported (currently all scales in any

> module in the course are being included). This involves creating a new function in

> backup/lib.php called backup_scale_used() really similar to the course based but

> skipping not selected modules. For 1.5?

+1, but with a setting for it, like:

there are scales, but they're not used anywhere. Do you still want to export them?

> 4.-And finally, events. A setting for this could be really nice and easy to

> implement. As such info in not related to the rest of the backup (like groups or

> scales) having a check to decide it is really a good idea. For 1.5?

Yup! Sounds good. +1

From (penny at catalyst.net.nz) Wednesday, 12 October 2005, 10:44 AM:

bump! anything happened on this one?

From Eloy Lafuente (stronk7 at moodle.org) Friday, 14 October 2005, 03:52 AM:

Hey,

this was lost in the abyss of my bugs...

Should I try to do it or, perhaps, you have intentions to do so?

About 3, perhaps the setting should be a popup between:

  • Needed Scales (all those being used by selected activities).
  • All Scales (all those being used by any activity in the course, like it's now).

About 4, a simple Y/N will be enough, I think.

From Eloy Lafuente (stronk7 at moodle.org) Wednesday, 3 May 2006, 03:48 AM:

Hehe,

what if....we postpone this some more months? :-P

...orr perhaps somebody else could try it after 1.6 branch... I estimate that my time availability next 5-6 moths is going to be really short! But moodling, of course! B-)


Michael Blake made changes - 21/Aug/06 04:21 PM
Field Original Value New Value
Assignee Eloy Lafuente [ eloylafuente ] Eloy Lafuente [ stronk7 ]
Timothy Takemoto added a comment - 17/Oct/06 11:53 AM
> From (penny at catalyst.net.nz) Thursday, 10 March 2005, 04:18 AM:
> 1-Having a setting for groups could be a nightmare because modules running
> under groups in the original course have to be modified to take care of this
> setting to delete their group info (and group mode). It's possible to implement it
> but perhaps it's too late for 1.5...
Eloy wrote
> I agree that it would be a nightmare, because of all the modules and how they work
> with groups. Maybe for 1.6? I mean, I'd love it for 1.5 but it may be unrealistic.

I would like the ability to turn off backup/restore groups.

Especially in the case when the course contains no group settings. In other words initially the setting could be quite, violent.
It could throw away all group associated data.

Tim


Nick Freear added a comment - 02/Oct/07 10:07 PM
Hi,
Just found this bug, and the option to include/exclude groups (and groupings?) on backup/restore is something we'd very much like at the OU. I agree we need to define what happens for activities in group mode.

I'm not sure it can be done for 1.9, but I took the liberty of updating the "Affects versions" and Components information.
Many thanks

Nick

[OU Bug 3132 "groups are copied from previous course presentations on backup/restore" - Sophie]


Nick Freear made changes - 02/Oct/07 10:07 PM
Component/s Groups [ 10163 ]
Description It seems to me that backup and restore will always include groups and group memberships, regardless of whether user info is selected or not.



I think the correct behaviour would be to always backup/restore group names, but only backup/restore the group memberships if user info has been selected.



Thoughts?
It seems to me that backup and restore will always include groups and group memberships, regardless of whether user info is selected or not.

I think the correct behaviour would be to always backup/restore group names, but only backup/restore the group memberships if user info has been selected.

Thoughts?
Affects Version/s 1.9 [ 10190 ]
Nick Freear added a comment - 29/Nov/07 12:30 AM
Penny & Eloy,
I'm looking at a potential fix for this bug for HEAD/2.0, see the Moodle Wiki,
http://docs.moodle.org/en/Development:Groupings_OU#Groups_optional_backup.2Frestore

I'm investigating just giving the user an option on restore initially. This should be quicker to implement - I'm on a tight schedule to do this for the OU.
Hopefully have a patch soon. Comments welcome!
Thanks

Nick


Nick Freear added a comment - 06/Dec/07 01:58 AM
Finally a patch. It affects 9 files:

-backup/restore_form.html
-backup/restorelib.php - 3 constants defined, new function restore_group_getid
+ other mods.
-backup/restore_check.html

-lang/en_utf8/group.php
-lang/en_utf8/moodle.php - missing backup string 'writinggroupingsgroupsinfo'.

-mod/chat/restorelib.php
-mod/data/restorelib.php
-mod/forum/restorelib.php
-mod/wiki/restorelib.php

I would like to commit to HEAD in the next day or so, and possibly back port to 1.9 - definitely Skype beforehand!
(Petr, hope you don't mind me adding you as a watcher.)

Comments welcome! Thanks
Nick


Nick Freear made changes - 06/Dec/07 01:58 AM
Nick Freear made changes - 06/Dec/07 02:22 AM
Link This issue has been marked as being related by MDL-12453 [ MDL-12453 ]
Eloy Lafuente (stronk7) added a comment - 06/Dec/07 03:06 AM
Looks correct. Cool!

Only 1thought (not critical) that have arrived while reviewing the code:

Shouldn't activity group mode be "reseted" acordingly with the "reset" that code performs in discussions /entries.... ? not 100% sure, just one thought about what is more "logical".

Ciao


Eloy Lafuente (stronk7) made changes - 06/Dec/07 03:06 AM
Assignee Eloy Lafuente (stronk7) [ stronk7 ] Nick Freear [ nfreear ]
Nick Freear added a comment - 08/Dec/07 12:53 AM
Version 8 core of the patch - 1 extra file + modifications:
  • lang/en_utf8/help/grouprestore.html
  • backup/restorelib.php - added the 4th RESTORE_GROUPS_NONE constant - now a full set!

In response to Eloy - it may be logical to reset group mode, but for us (OU) and hopefully others, it seems more useful to maintain activity group mode so that groups can be recreated. The new help file hopefully explains this, and the group restore options generally.

Comments welcome! I'd like to commit this Monday 10th to HEAD, and maybe 1.9 - if I get the nod
Ciao.


Nick Freear made changes - 08/Dec/07 12:53 AM
Nick Freear added a comment - 10/Dec/07 07:18 PM
Hi, I've committed revision 8 of the patch (affecting 10 files, see previous comments) to Moodle HEAD. Can I backport this to 1.9 branch now?
Thanks, Nick.

Nick Freear committed 10 files to 'Moodle CVS' - 10/Dec/07 07:26 PM
Fixes bug MDL-2674, "backup always backsup/restores groups regardless of user settings" - restore group/grouping option.
MODIFY backup/restore_check.html   Rev. 1.49    (+4 -1 lines)
MODIFY mod/forum/restorelib.php   Rev. 1.61    (+3 -2 lines)
MODIFY mod/chat/restorelib.php   Rev. 1.23    (+3 -2 lines)
MODIFY backup/restorelib.php   Rev. 1.295    (+60 -7 lines)
MODIFY lang/en_utf8/moodle.php   Rev. 1.155    (+3 -2 lines)
ADD lang/en_utf8/help/grouprestore.html   Rev. 1.1    (+0 -0 lines)
MODIFY mod/wiki/restorelib.php   Rev. 1.18    (+3 -2 lines)
MODIFY mod/data/restorelib.php   Rev. 1.29    (+2 -2 lines)
MODIFY lang/en_utf8/group.php   Rev. 1.26    (+4 -1 lines)
MODIFY backup/restore_form.html   Rev. 1.64    (+32 -1 lines)
Mitsuhiro Yoshida committed 12 files to 'Lang CVS' - 11/Dec/07 05:09 AM
Translated new strings for group and grouping MDL-2674.
Addin a new translated help file for group restore MDL-2674.
Brushed up translated strings and help files.
MODIFY ja_utf8/README   Rev. 1.589    (+1 -1 lines)
MODIFY ja_utf8/help/feedback/mapcourse.html   Rev. 1.6    (+1 -1 lines)
MODIFY ja_utf8/block_attendance.php   Rev. 1.9    (+2 -1 lines)
MODIFY ja_utf8/help/question/permissions.html   Rev. 1.3    (+1 -1 lines)
MODIFY ja_utf8/resource.php   Rev. 1.27    (+3 -3 lines)
ADD ja_utf8/help/grouprestore.html   Rev. 1.1    (+0 -0 lines)
MODIFY ja_utf8/help/lesson/questiontypes.html   Rev. 1.18    (+2 -3 lines)
MODIFY ja_utf8/glossary.php   Rev. 1.37    (+3 -3 lines)
MODIFY ja_utf8/moodle.php   Rev. 1.262    (+3 -2 lines)
MODIFY ja_utf8/group.php   Rev. 1.26    (+3 -1 lines)
MODIFY ja_utf8/auth.php   Rev. 1.57    (+2 -2 lines)
MODIFY ja_utf8/admin.php   Rev. 1.221    (+8 -8 lines)
martignoni committed 2 files to 'Lang CVS' - 14/Dec/07 07:15 PM
Fixes bug MDL-2674, "backup always backsup/restores groups regardless of user settings" - restore group/grouping option.
MODIFY fr_utf8/group.php   Rev. 1.31    (+3 -1 lines)
MODIFY fr_utf8/moodle.php   Rev. 1.186    (+2 -1 lines)
Petr Skoda made changes - 09/Mar/08 09:42 PM
Site All
Parent MDL-13847 [ 25343 ]
Issue Type Bug [ 1 ] Sub-task [ 5 ]
Petr Skoda made changes - 18/Mar/08 05:19 AM
Assignee Nick Freear [ nfreear ] Petr Skoda [ skodak ]
Petr Skoda added a comment - 18/Mar/08 05:21 AM - edited
taking over this one:
  • backporting for 1.9.1
  • adding restore_grouping_getid() - we need to fix cm->groupingid if groupings not restored
  • adding option to restore groups only without groupings
  • perf improvements
  • I do not think there should be PHP "ifs" in help files, we should be able to describe both functions without/with groupings

Petr Skoda committed 5 files to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 18/Mar/08 06:27 AM
MDL-2674 backup always backsup/restores groups regardless of user settings; backported from HEAD
MODIFY backup/restore_check.html   Rev. 1.48.2.2    (+4 -1 lines)
MODIFY backup/restorelib.php   Rev. 1.283.2.29    (+49 -4 lines)
MODIFY backup/restore_form.html   Rev. 1.60.2.5    (+33 -1 lines)
MODIFY lang/en_utf8/help/grouprestore.html   Rev. 1.1.2.2    (+33 -0 lines)
MODIFY lang/en_utf8/group.php   Rev. 1.22.2.4    (+4 -1 lines)
Petr Skoda committed 2 files to 'Moodle CVS' - 18/Mar/08 06:33 AM
MDL-2674 backup always backsup/restores groups regardless of user settings; remerged from MOODLE_19_STABLE
MODIFY backup/restorelib.php   Rev. 1.314    (+3 -1 lines)
MODIFY backup/restore_form.html   Rev. 1.66    (+4 -3 lines)
Petr Skoda committed 4 files to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 18/Mar/08 06:33 AM
MDL-2674 backup always backsup/restores groups regardless of user settings; backported from HEAD
MODIFY mod/forum/restorelib.php   Rev. 1.60.4.4    (+2 -2 lines)
MODIFY mod/wiki/restorelib.php   Rev. 1.17.6.1    (+3 -2 lines)
MODIFY mod/chat/restorelib.php   Rev. 1.22.6.2    (+2 -2 lines)
MODIFY mod/data/restorelib.php   Rev. 1.27.2.2    (+2 -2 lines)
Petr Skoda committed 2 files to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 18/Mar/08 06:54 AM
MDL-2674 adding $cm->grouping reset if groupings not restored; removed info about groups included in backup - they are always included, and there will not be any global groups/groupings
MODIFY backup/restorelib.php   Rev. 1.283.2.30    (+17 -14 lines)
MODIFY backup/restore_form.html   Rev. 1.60.2.6    (+2 -2 lines)
Petr Skoda committed 2 files to 'Moodle CVS' - 18/Mar/08 06:57 AM
MDL-2674 adding $cm->grouping reset if groupings not restored; removed info about groups included in backup - they are always included, and there will not be any global groups/groupings; merged from MOODLE_19_STABLE
MODIFY backup/restore_form.html   Rev. 1.67    (+2 -2 lines)
MODIFY backup/restorelib.php   Rev. 1.315    (+17 -14 lines)
Petr Skoda made changes - 18/Mar/08 07:01 AM
Fix Version/s 1.9.1 [ 10240 ]
Petr Skoda committed 1 file to 'Moodle CVS' - 18/Mar/08 07:09 AM
MDL-2674 removed hardcoded renaming of groupings depending on changed course shortname
MODIFY backup/restorelib.php   Rev. 1.316    (+2 -9 lines)
Petr Skoda added a comment - 21/Mar/08 04:58 AM
Helen, could you please tweak the docs so that there is no PHP code in it, thanks!

Petr Skoda made changes - 21/Mar/08 04:58 AM
Assignee Petr Skoda [ skodak ] Helen Foster [ tsala ]
Petr Skoda added a comment - 21/Mar/08 04:59 AM
...and close this when done, thanks

wildgirl committed 1 file to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 21/Mar/08 05:48 AM
MDL-2674 PHP code removed from help file
MODIFY lang/en_utf8/help/grouprestore.html   Rev. 1.1.2.3    (+10 -29 lines)
wildgirl committed 1 file to 'Moodle CVS' - 21/Mar/08 06:07 AM
MDL-2674 PHP code removed from help file, small rewording
MODIFY lang/en_utf8/help/grouprestore.html   Rev. 1.2    (+2 -31 lines)
wildgirl committed 1 file to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 21/Mar/08 06:07 AM
MDL-2674 PHP code removed from help file, small rewording
MODIFY lang/en_utf8/help/grouprestore.html   Rev. 1.1.2.4    (+2 -12 lines)
Petr Skoda committed 2 files to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 21/Mar/08 06:16 AM
MDL-2674 minor lang improvement
MODIFY lang/en_utf8/group.php   Rev. 1.22.2.5    (+1 -0 lines)
MODIFY backup/restore_form.html   Rev. 1.60.2.8    (+2 -2 lines)
Petr Skoda committed 2 files to 'Moodle CVS' - 21/Mar/08 06:17 AM
MDL-2674 minor lang improvement; backported from MOODLE_19_STABLE
MODIFY lang/en_utf8/group.php   Rev. 1.27    (+1 -0 lines)
MODIFY backup/restore_form.html   Rev. 1.69    (+3 -3 lines)
Helen Foster added a comment - 21/Mar/08 06:18 AM
Thanks for everyone's work on this

PHP removed and help file reworded.


Helen Foster made changes - 21/Mar/08 06:18 AM
Resolution Fixed [ 1 ]
Status In Progress [ 3 ] Resolved [ 5 ]
Mitsuhiro Yoshida committed 3 files to 'Lang CVS' - 21/Mar/08 10:05 AM
Translated a new string for group.MDL-2674.
Updated a translated help file for group restore based on lang/en_utf8 change MDL-2674.
MODIFY ja_utf8/README   Rev. 1.667    (+1 -1 lines)
MODIFY ja_utf8/group.php   Rev. 1.29    (+33 -32 lines)
MODIFY ja_utf8/help/grouprestore.html   Rev. 1.2    (+2 -28 lines)
Anthony Borrow made changes - 23/Mar/08 11:15 AM
Link This issue is duplicated by MDL-11885 [ MDL-11885 ]
martignoni committed 1 file to 'Lang CVS' - 25/Mar/08 03:11 AM
MDL-2674: new help file added
ADD fr_utf8/help/grouprestore.html   Rev. 1.1    (+0 -0 lines)
martignoni committed 1 file to 'Lang CVS' - 25/Mar/08 03:13 AM
MDL-2674 new string added
MODIFY fr_utf8/group.php   Rev. 1.32    (+2 -1 lines)
Eloy Lafuente (stronk7) added a comment - 16/Apr/08 08:09 AM
Closing as requested. Thanks!

Eloy Lafuente (stronk7) made changes - 16/Apr/08 08:09 AM
QA Assignee stronk7
Status Resolved [ 5 ] Closed [ 6 ]
Timothy Takemoto added a comment - 02/Oct/09 03:01 PM
I see that his is only for 1.9 and above.

I still use 1.6

Does anyone have any suggestions on a hack for 1.6 to just ignore all backup and restore of groups?


David Mudrak added a comment - 02/Oct/09 05:08 PM
Timothy, Moodle 1.6 is not supported version any more (and we are going to stop supporting 1.7 on October 31). You should upgrade your server anyway as using 1.6 may be considered as a sort of hazard...

Timothy Takemoto added a comment - 02/Oct/09 05:43 PM
I don't think that I have that luxury. I would like to avoid the hazard.

The first of the two diffs looked like it was going to work since it is for 1.6.3
(I am using that on one site..) but mine is now 1.6.2+ and there were no references
to groupingid in my restorelib.php. Drat.

Tim


Petr Skoda added a comment - 02/Oct/09 05:49 PM
1.6.2+ - is that a joke? I hope it is not accessible from internet, is it?!

Timothy Takemoto added a comment - 02/Oct/09 07:24 PM
Ha ha!
It is accessible from the internet. The only thing that is accessible is the login page, to a IMAP server, and I trust my students not to hack, but maybe the loging is no longer secure.
I wish that there were security patches available.
I may upgrade to 1.6.3 but that is the limit of my TUI module, which cost me 2000 dollars, that I like.
If I upgrade to 1.6.3 then then I can apply the patch above. I am not aware of other things that I want from moodle. Roles!?
But I do need to fix this bug.

Petr Skoda added a comment - 02/Oct/09 07:41 PM
There is nothing like "only login page is accessible" - you do not need any login in order to exploit some bugs. Upgrading to 1.6.3 does not solve anything, you must upgrade to latest MOODLE_16_STABLE cvs branch at least, but even that is not enough because 1.6.x is not maintained - no more bug&security fixes there

Timothy Takemoto added a comment - 02/Oct/09 07:53 PM
Well, as I have said in conversation before, I wish that would would tell us about the bug fixes rather than encourage us to upgrade.

Petr Skoda added a comment - 02/Oct/09 08:26 PM
I just looked at the TUI code available from the module database - it is very old code from 1.5.x times that is still relying on register globals, no new param cleaning, etc. - this module alone has probably many security issues itself.

Timothy Takemoto added a comment - 02/Oct/09 09:02 PM
I hacked TUI to work with 1.6. Register globals...when was that turned off?
Can people access TUI without login?

Anyway, anyway, tell us the issues. I bet that there are very few. 5? 10? patchable.

Please share the patches. I do not want to be on a windows-like bloatware upgrade escalator.
Moodle is enough for me (the contents are the problem) at 1.6.

Last time we had this conversation I looked through the security issues and it seemed to
me that all of them were relevant to those that used blogs or ... modules that I was not using.

But I need this. Groups restoring even though you don't want them to, is a real pain.


Petr Skoda added a comment - 02/Oct/09 09:10 PM - edited
I am sorry, I am not going to review/fix dead code - I have to concentrate on 1.9.6 and 2.0 right now

Timothy Takemoto added a comment - 03/Oct/09 02:16 AM
It is kind of you to even consider it. Good luck with 2.0.
I will look into moving to 1.6 stable, and then applying the first of the two patches above.
Tim