Quantcast
Channel: Backup and restore
Viewing all articles
Browse latest Browse all 6815

Re: How to overwrite an existing course in a script?

$
0
0
by Perry Way.  

Hello Séverin,

I intuited this was probably the case after looking for references to that constant in the Moodle source code, and made my code changes last night before leaving for home. I was going to attempt running it this morning and find out for myself. At first thought when making this script I thought that deleting meant it would delete whatever matched the content, but not overwrite the entire course contents (which is what this script's use is intended for). With my developer experience I've always commented all constants that I have declared with what their usage is intended for. Those kind of comments are not in the declarations section and their naming isn't congruent with my intuition. It's really good to be very explicit with these things. However, with some degree of study I seemed to pick up on the usage. But, that all said I really appreciate you commenting on this thread. Maybe in the future this will benefit other people as well! Thanks!

It's interesting though that just a few lines down in the abstract class declaration you'll find these constants, and notice their values are commented on.

    // Some constants used to identify some helpfull processor variables
    // (using negative numbers to avoid any collision posibility
    // To be used when defining backup structures
    const VAR_COURSEID   = -1;  // To reference id of course in a processor
    const VAR_SECTIONID  = -11; // To reference id of section in a processor
    const VAR_ACTIVITYID = -21; // To reference id of activity in a processor
    const VAR_MODID      = -31; // To reference id of course_module in a processor
    const VAR_MODNAME    = -41; // To reference name of module in a processor
    const VAR_BLOCKID    = -51; // To reference id of block in a processor
    const VAR_BLOCKNAME  = -61; // To reference name of block in a processor
    const VAR_CONTEXTID  = -71; // To reference context id in a processor
    const VAR_PARENTID   = -81; // To reference the first parent->id in a backup structure

Viewing all articles
Browse latest Browse all 6815

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>