Moodle
  1. Moodle
  2. MDL-25031

Upgrade process fails if pagetype null

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0, 2.2, 2.2.10
    • Fix Version/s: 2.2.11
    • Component/s: Installation
    • Labels:
    • Database:
      MySQL
    • Testing Instructions:
      Hide

      1/ install Moodle 1.9
      2/ create courses with many blocks
      3/ enable blocks support in activities (theme settings) and add some blocks to lesson for example
      4/ use DB editor to delete source course records and lesson records
      5/ execute upgrade to 2.2.x
      6/ verify the upgrade completes without block errors and that the blocks are upgraded properly (including activity blocks)

      Show
      1/ install Moodle 1.9 2/ create courses with many blocks 3/ enable blocks support in activities (theme settings) and add some blocks to lesson for example 4/ use DB editor to delete source course records and lesson records 5/ execute upgrade to 2.2.x 6/ verify the upgrade completes without block errors and that the blocks are upgraded properly (including activity blocks)
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE
    • Pull from Repository:
    • Rank:
      16458

      Description

      Hi Petr,

      Experienced this issue when upgrading a site from 1.9.10 -> 2.0 RC1.

      Debug info: Column 'pagetype' cannot be null

      INSERT INTO mdl_block_positions (blockinstanceid, contextid, pagetype, subpage, visible, region, weight)
      SELECT id, contextid,
      CASE WHEN pagetypepattern = 'course-view-*' THEN
      (SELECT CONCAT('course-view-', format)
      FROM mdl_course
      JOIN mdl_context ON mdl_course.id = mdl_context.instanceid
      WHERE mdl_context.id = contextid)
      ELSE pagetypepattern END,
      CASE WHEN subpagepattern IS NULL THEN ''
      ELSE subpagepattern END,
      0, defaultregion, defaultweight
      FROM mdl_block_instances WHERE visible = 0 AND pagetypepattern <> 'admin-*'
      [array (
      )]

      Stack trace:

      • line 394 of /lib/dml/moodle_database.php: dml_write_exception thrown
      • line 645 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      • line 1858 of /lib/db/upgrade.php: call to mysqli_native_moodle_database->execute()
      • line 1309 of /lib/upgradelib.php: call to xmldb_main_upgrade()
      • line 264 of /admin/index.php: call to upgrade_core()

        Issue Links

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: