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

Upgrade page in Clean calls navigation

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.6.2
    • Fix Version/s: 2.7
    • Component/s: Themes
    • Labels:

      Description

      This is a blocker for having Clean as default theme. Upgrade is not possible in the following case:

      during upgrade module adds a field to DB, it also accesses this field when rebuilding course cache.

      To reproduce: create an assignment on the frontpage and apply this patch:

      diff --git a/mod/assign/lib.php b/mod/assign/lib.php
      index 42dff0a..6491cc7 100644
      --- a/mod/assign/lib.php
      +++ b/mod/assign/lib.php
      @@ -259,7 +259,7 @@ function assign_get_coursemodule_info($coursemodule) {
           global $CFG, $DB;
       
           $dbparams = array('id'=>$coursemodule->instance);
      -    $fields = 'id, name, alwaysshowdescription, allowsubmissionsfromdate, intro, introformat';
      +    $fields = 'id, name, alwaysshowdescription, allowsubmissionsfromdate, intro, introformat, asdf';
           if (! $assignment = $DB->get_record('assign', $dbparams, $fields)) {
               return false;
           }
      diff --git a/mod/assign/version.php b/mod/assign/version.php
      index e6e6d2e..e22b691b 100644
      --- a/mod/assign/version.php
      +++ b/mod/assign/version.php
      @@ -25,7 +25,7 @@
       defined('MOODLE_INTERNAL') || die();
       
       $plugin->component = 'mod_assign'; // Full name of the plugin (used for diagnostics).
      -$plugin->version  = 2014020500;    // The current module version (Date: YYYYMMDDXX).
      +$plugin->version  = 2014020501;    // The current module version (Date: YYYYMMDDXX).
       $plugin->requires = 2013110500;    // Requires this Moodle version.
       $plugin->cron     = 60;
      

      Now the upgrade page can not be accessed at all:

       Error reading from database
      Debug info: ERROR: column "asdf" does not exist
      LINE 1: ...on, allowsubmissionsfromdate, intro, introformat, asdf FROM ...
      ^
      SELECT id, name, alwaysshowdescription, allowsubmissionsfromdate, intro, introformat, asdf FROM m_assign WHERE id = $1
      [array (
      0 => '1',
      )]
      Error code: dmlreadexception
      Stack trace:
       
          line 443 of /lib/dml/moodle_database.php: dml_read_exception thrown
          line 240 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
          line 760 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
          line 1476 of /lib/dml/moodle_database.php: call to pgsql_native_moodle_database->get_records_sql()
          line 1448 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
          line 1427 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
          line 263 of /mod/assign/lib.php: call to moodle_database->get_record()
          line 1080 of /course/lib.php: call to assign_get_coursemodule_info()
          line 617 of /lib/modinfolib.php: call to get_array_of_activities()
          line 450 of /lib/modinfolib.php: call to course_modinfo::build_course_cache()
          line 411 of /lib/modinfolib.php: call to course_modinfo->__construct()
          line 2013 of /lib/modinfolib.php: call to course_modinfo::instance()
          line 1832 of /lib/navigationlib.php: call to get_fast_modinfo()
          line 1896 of /lib/navigationlib.php: call to global_navigation->generate_sections_and_activities()
          line 443 of /course/format/lib.php: call to global_navigation->load_generic_course_sections()
          line 1811 of /lib/navigationlib.php: call to format_base->extend_course_navigation()
          line 1114 of /lib/navigationlib.php: call to global_navigation->load_course_sections()
          line 222 of /blocks/navigation/block_navigation.php: call to global_navigation->initialise()
          line 178 of /blocks/navigation/block_navigation.php: call to block_navigation->get_navigation()
          line 294 of /blocks/moodleblock.class.php: call to block_navigation->get_content()
          line 236 of /blocks/moodleblock.class.php: call to block_base->formatted_contents()
          line 956 of /lib/blocklib.php: call to block_base->get_content_for_output()
          line 1008 of /lib/blocklib.php: call to block_manager->create_block_contents()
          line 361 of /lib/outputrenderers.php: call to block_manager->ensure_content_created()
          line 33 of /theme/clean/layout/maintenance.php: call to core_renderer->standard_head_html()
          line 877 of /lib/outputrenderers.php: call to include()
          line 807 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
          line ? of unknownfile: call to core_renderer->header()
          line 240 of /lib/outputrenderers.php: call to call_user_func_array()
          line 206 of /admin/renderer.php: call to plugin_renderer_base->__call()
          line 206 of /admin/renderer.php: call to core_admin_renderer->header()
          line 417 of /admin/index.php: call to core_admin_renderer->upgrade_plugin_check_page()
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              skodak Petr Skoda
              Reporter:
              marina Marina Glancy
              Peer reviewer:
              Andrew Davis Andrew Davis
              Integrator:
              Sam Hemelryk Sam Hemelryk
              Tester:
              Adrian Greeve Adrian Greeve
              Participants:
              Component watchers:
              Huong Nguyen, Bas Brands, Mathew May
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                12/May/14