public function upgrade(context $oldcontext,
                            stdClass $oldassignment,
                            stdClass $oldsubmission,
                            stdClass $grade,
                            & $log) {
        global $DB;

        // Now copy the area files.
        $this->assignment->copy_area_files_for_upgrade($oldcontext->id,
                                                        'mod_assignment',
                                                        'response',
                                                        $oldsubmission->id,
                                                        $this->assignment->get_context()->id,
                                                        'assignfeedback_file',
                                                        ASSIGNFEEDBACK_FILE_FILEAREA,
                                                        $grade->id);

        // Now count them!
        $filefeedback = new stdClass();
        $filefeedback->numfiles = $this->count_files($grade->id, ASSIGNFEEDBACK_FILE_FILEAREA);
        $filefeedback->grade = $grade->id;
        $filefeedback->assignment = $this->assignment->get_instance()->id;
        if (!$DB->insert_record('assignfeedback_file', $filefeedback) > 0) {
            $log .= get_string('couldnotconvertgrade', 'mod_assign', $grade->userid);
            return false;
        }
        return true;
    }
public function upgrade(context $oldcontext,
                            stdClass $oldassignment,
                            stdClass $oldsubmission,
                            stdClass $grade,
                            & $log) {
        global $DB;

        // Now copy the area files.
        $this->assignment->copy_area_files_for_upgrade($oldcontext->id,
                                                        'mod_assignment',
                                                        'response',
                                                        $oldsubmission->id,
                                                        $this->assignment->get_context()->id,
                                                        'assignfeedback_file',
                                                        ASSIGNFEEDBACK_FILE_FILEAREA,
                                                        $grade->id);

        // Now count them!
        $filefeedback = new stdClass();
        $filefeedback->numfiles = $this->count_files($grade->id, ASSIGNFEEDBACK_FILE_FILEAREA);
        $filefeedback->grade = $grade->id;
        $filefeedback->assignment = $this->assignment->get_instance()->id;
        if (!$DB->insert_record('assignfeedback_file', $filefeedback) > 0) {
            $log .= get_string('couldnotconvertgrade', 'mod_assign', $grade->userid);
            return false;
        }
        return true;
    }
public function upgrade ( context $ oldcontext , stdClass $ oldassignment , stdClass $ oldsubmission , stdClass $ grade , & $ log ) { global $ DB ; // Now copy the area files. $ this -> assignment -> copy_area_files_for_upgrade ( $ oldcontext -> id , 'mod_assignment' , 'response' , $ oldsubmission -> id , $ this -> assignment -> get_context ( ) -> id , 'assignfeedback_file' , ASSIGNFEEDBACK_FILE_FILEAREA , $ grade -> id ) ; // Now count them! $ filefeedback = new stdClass ( ) ; $ filefeedback -> numfiles = $ this -> count_files ( $ grade -> id , ASSIGNFEEDBACK_FILE_FILEAREA ) ; $ filefeedback -> grade = $ grade -> id ; $ filefeedback -> assignment = $ this -> assignment -> get_instance ( ) -> id ; if ( ! $ DB -> insert_record ( 'assignfeedback_file' , $ filefeedback ) > 0 ) { $ log .= get_string ( 'couldnotconvertgrade' , 'mod_assign' , $ grade -> userid ) ; return false ; } return true ; }
Upgrade the feedback from the old assignment to the new one.

@param context $oldcontext - the database for the old assignment context
@param stdClass $oldassignment The data record for the old assignment
@param stdClass $oldsubmission The data record for the old submission
@param stdClass $grade The data record for the new grade
@param string $log Record upgrade messages in the log
@return bool true or false - false will trigger a rollback
Upgrade the feedback from the old assignment to the new one .