Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-34525

Incorrect pool file content when restoring a course


    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.3.1
    • Fix Version/s: None
    • Component/s: Backup
    • Labels:
    • Affected Branches:


      When restoring a course from Moodle 1.98 into Moodle 2.31, we encountered an error on the final step which said "Incorrect pool file content". It did not have a hash or anything else after the word "content" like other issues listed in the tracker.

      After activating the debugger and playing around with it for awhile, we discovered that the issue was due to an empty <REFERENCE> element in the "moodle.xml" file in the backup. Once we removed any files that had an empty reference, we didn't incur any problems. Additionally, we resolved the issue by adding the following code:


      Lines: 204 - 209

      if(trim($reference) !== '') {
        try {
          $this->fileman->migrate_file('course_files/'.$reference, $curfilepath, null, 1);
        } catch (moodle1_convert_exception $e) {
          // the file probably does not exist
          $this->log('error migrating the resource main file', backup::LOG_WARNING, 'course_files/'.$reference);
      } else {
        $this->log('file reference is empty', backup::LOG_WARNING);

      This prevents the system from trying to migrate a file to the new system if the file reference is empty.

        Gliffy Diagrams




              • Votes:
                7 Vote for this issue
                1 Start watching this issue


                • Created: