General developer forum

how to suggest changes to core Moodle code - flat file upload improvement

 
Picture of Jason Long
how to suggest changes to core Moodle code - flat file upload improvement
 

I have made a 4-line change to /admin/tool/uploadcourse/classes/helper.php (detailed below) that deals with uploading flat files.  I've been modifying this file for years - since at least 2.6 - and it's worked every time.  I think it's worth formally suggesting this modification to the core Moodle code since flat-file enrollment doesn't seem to be touched on much.  How does one go about doing this?


For those interested, here's what it does:

The current flat-file upload process isn't very robust when it comes to categores:  it requires categories to be created in Moodle before they can be used by flat files to upload courses.  Flat files can only be added to existing categories as they use ID numbers of categories to assign the courses.  I made this one minor change which tells Moodle if it receives a category name (not ID) to just go ahead and create the category so it can upload the course instead of failing to upload the course.  (Otherwise you have to create categories in Moodle first and then import that data back to the SIS to then get the correct category IDs for each course, which is a burden to us.)

Here is the edit I made for anyone needing it for their own Moodle:

In /admin/tool/uploadcourse/classes/helper.php on line 465 and 466, comment out this part:

$id = -1;
break;

And add this code below it before the }

$a_new_category = coursecat::create($params);
$record = reset($records);
$id = $a_new_category->id;
$parent = $id;

 
Average of ratings: -
Picture of Dave Balch
Re: how to suggest changes to core Moodle code - flat file upload improvement
Core developersParticularly helpful MoodlersPlugin developers

Hi Jason,

The first step is to create an issue about it on https://tracker.moodle.org/

See https://docs.moodle.org/dev/Process for the full process. It may seem like overkill for what looks like a small change, but that's the cost of keeping standards high on a complicated project mixed

HTH,

Dave.


 
Average of ratings: -
Picture of Jason Long
Re: how to suggest changes to core Moodle code - flat file upload improvement
 

Thank you so much!  That was exactly what I was looking for!

 
Average of ratings: -
Picture of Rex Lorenzo
Re: how to suggest changes to core Moodle code - flat file upload improvement
Core developersParticularly helpful MoodlersPlugin developersPlugins guardiansTesters

The caveat is that new developers cannot create tickets in the Moodle Tracker. You would need to try to see if a similar issue was reported in Tracker already (sometimes it is) or have a git branch developed and have someone create a new issue for you.

 
Average of ratings: -
Picture of Jason Long
Re: how to suggest changes to core Moodle code - flat file upload improvement
 

Well I did manage to submit the request, so hopefully that will work out!  (I checked and obviously nothing similar is in there since this is a very specific improvement.)

 
Average of ratings: -