Moodle

Block restore for modules can fail or insert invalid block_instance records

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.8.4
  • Fix Version/s: 1.8.5, 1.9
  • Component/s: Backup
  • Labels:
    None
  • Affected Branches:
    MOODLE_18_STABLE
  • Fixed Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE

Description

In the backup process, all block from all modules are backed up regardless if the module has been selected for backup. So, during the restore process, the block restore code never checks to see if the pageid remaps correctly. This results in the pageid being set to NULL, causing the restore to fail, or the pageid being set to 0, creating an invalid block_instance record.

Attached is a fix in the restore process. A further fix would be to only backup those blocks that belong to modules that are actually being backed up. Regardless though, I think the attached patch should be added to restorelib.php.

Activity

Hide
Martin Dougiamas added a comment -

Thanks Mark.

Eloy, I've checked this in as it's so small and seems to make sense. I'd be happy if you have any time to just run an eye over it though.

Show
Martin Dougiamas added a comment - Thanks Mark. Eloy, I've checked this in as it's so small and seems to make sense. I'd be happy if you have any time to just run an eye over it though.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: