fix_course_sortorder(): fix breakage with large categories, saner error
authormartinlanghoff <martinlanghoff>
Wed, 12 Sep 2007 02:56:16 +0000 (02:56 +0000)
committermartinlanghoff <martinlanghoff>
Wed, 12 Sep 2007 02:56:16 +0000 (02:56 +0000)
commitf8ea60777cbee3ef2b44b6bc46f45e525c567130
tree9281ae16e659e3c209f9505eabd5687c30c60c08
parentdc6cc11a724f5b3d85e85635e65741dc1a98853f
fix_course_sortorder(): fix breakage with large categories, saner error

Two improvements for fix_course_sortorder()

 - If the category has more courses than the shift range
   use a larger shift range to avoid overlapping with itself

 - If things do go wrong during the per-course sortorder updates,
   rollback and try and call ourselves with a 'safe' flag.

Still - far from perfect. Probably the global sortorder approach
is broken. The sanest way is to rework things to always join against
course_categories and order by the combined sortorders.
lib/datalib.php