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

Upgrade to 2.4 beta from Moodle master Undefined Property notice

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4, 2.5
    • Fix Version/s: 2.4.1
    • Component/s: Course, Installation
    • Labels:
      None
    • Testing Instructions:
      Hide

      Use an installation prior to 2.4

      1. manually change in DB course.format to something strange, like 'social' for the site-course (look for course with category=0)
      2. upgrade to 2.4
      3. make sure there are no errors during upgrade and when viewing the front page
      Show
      Use an installation prior to 2.4 manually change in DB course.format to something strange, like 'social' for the site-course (look for course with category=0) upgrade to 2.4 make sure there are no errors during upgrade and when viewing the front page
    • Affected Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE
    • Pull Master Branch:
      wip-MDL-36840-master

      Description

      On upgrading the DB for 2.4, the update says it went smoothly but a few PHP notices are logged, and potentially the process didn't finish.

      Dump:
      [root@clone cli]# /usr/bin/php -r "posix_setuid('48'); require_once('/var/www/vhosts/moodle.org/html/admin/cli/upgrade.php');" – --non-interactive --allow-unstable
      -->System
      ++ Success ++
      -->mod_assign
      ++ Success ++
      -->mod_book
      ++ Success ++
      -->mod_lesson
      ++ Success ++
      -->mod_workshop
      ++ Success ++
      -->auth_cas
      ++ Success ++
      -->auth_ldap
      ++ Success ++
      -->enrol_ldap
      ++ Success ++
      -->enrol_manual
      ++ Success ++
      -->enrol_self
      ++ Success ++
      -->block_activity_modules
      ++ Success ++
      -->block_admin_bookmarks
      ++ Success ++
      -->block_blog_menu
      ++ Success ++
      -->block_blog_recent
      ++ Success ++
      -->block_blog_tags
      ++ Success ++
      -->block_calendar_month
      ++ Success ++
      -->block_calendar_upcoming
      ++ Success ++
      -->block_comments
      ++ Success ++
      -->block_community
      ++ Success ++
      -->block_completionstatus
      ++ Success ++
      -->block_course_list
      ++ Success ++
      -->block_course_overview
      ++ Success ++
      -->block_course_summary
      ++ Success ++
      -->block_feedback
      ++ Success ++
      -->block_glossary_random
      ++ Success ++
      -->block_html
      ++ Success ++
      -->block_login
      ++ Success ++
      -->block_mentees
      ++ Success ++
      -->block_messages
      ++ Success ++
      -->block_mnet_hosts
      ++ Success ++
      -->block_myprofile
      ++ Success ++
      -->block_navigation
      ++ Success ++
      -->block_news_items
      ++ Success ++
      -->block_online_users
      ++ Success ++
      -->block_participants
      ++ Success ++
      -->block_private_files
      ++ Success ++
      -->block_quiz_results
      ++ Success ++
      -->block_recent_activity
      ++ Success ++
      -->block_rss_client
      ++ Success ++
      -->block_search_forums
      ++ Success ++
      -->block_section_links
      ++ Success ++
      -->block_selfcompletion
      ++ Success ++
      -->block_settings
      ++ Success ++
      -->block_site_main_menu
      ++ Success ++
      -->block_social_activities
      ++ Success ++
      -->block_tag_flickr
      ++ Success ++
      -->block_tag_youtube
      ++ Success ++
      -->block_tags
      ++ Success ++
      -->editor_tinymce
      ++ Success ++
      -->format_scorm
      ++ Success ++
      -->format_social
      ++ Success ++
      -->format_topics
      ++ Success ++
      -->format_weeks
      ++ Success ++
      -->booktool_print
      ++ Success ++
      PHP Notice: Undefined property: stdClass::$numsections in /var/www/vhosts/moodle.org/html/lib/adminlib.php on line 3381

      Notice: Undefined property: stdClass::$numsections in /var/www/vhosts/moodle.org/html/lib/adminlib.php on line 3381
      PHP Notice: Undefined property: stdClass::$numsections in /var/www/vhosts/moodle.org/html/lib/adminlib.php on line 3381

      Notice: Undefined property: stdClass::$numsections in /var/www/vhosts/moodle.org/html/lib/adminlib.php on line 3381
      Command line upgrade completed successfully.

        Gliffy Diagrams

          Activity

          Hide
          poltawski Dan Poltawski added a comment -

          Marina, does this look familiar?

          Show
          poltawski Dan Poltawski added a comment - Marina, does this look familiar?
          Hide
          marina Marina Glancy added a comment -

          seems that moodle.org database was modified manually and course.format field for site-course was 'social' instead of 'site'. After fixing field in DB the notice disappeared

          Show
          marina Marina Glancy added a comment - seems that moodle.org database was modified manually and course.format field for site-course was 'social' instead of 'site'. After fixing field in DB the notice disappeared
          Hide
          tsala Helen Foster added a comment -

          Thanks Marina, much appreciated.

          Show
          tsala Helen Foster added a comment - Thanks Marina, much appreciated.
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          Sorry, but upgrading a bunch of sites here, I got the same "endless loop" showing and showing the "numsections" frontpage setting.

          After a bit of reseatch with SamH we discovered that the ultimate cause was that "social" for the site course->format.

          And I never have edited that at all, so I bet that a lot of old sites are going to get this problem constantly.

          So I'm reopening it, we need to upgrade any "social" in frontpage course to "site".

          Ciao

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - Sorry, but upgrading a bunch of sites here, I got the same "endless loop" showing and showing the "numsections" frontpage setting. After a bit of reseatch with SamH we discovered that the ultimate cause was that "social" for the site course->format. And I never have edited that at all, so I bet that a lot of old sites are going to get this problem constantly. So I'm reopening it, we need to upgrade any "social" in frontpage course to "site". Ciao
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          (reopening because this happens in a lot of old sites)

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - (reopening because this happens in a lot of old sites)
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          Looking backwards, it seems that, at least in Moodle 1.7.x we had some assumptions about "social" being the default format:

          $form->format = optional_param('format', 'social', PARAM_ALPHA);

          I haven't looked more, that line demos that it was used as default at some point it the old days, so surely we need to perform the move for siteid for sites coming from such days.

          I can confirm that, by manually changing the column in the DB, the problem disappears.

          Ciao

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - Looking backwards, it seems that, at least in Moodle 1.7.x we had some assumptions about "social" being the default format: $form->format = optional_param('format', 'social', PARAM_ALPHA); I haven't looked more, that line demos that it was used as default at some point it the old days, so surely we need to perform the move for siteid for sites coming from such days. I can confirm that, by manually changing the column in the DB, the problem disappears. Ciao
          Hide
          marina Marina Glancy added a comment -

          I added in upgrade.php :

                  if ($SITE->format !== 'site') {
                      $DB->set_field('course', 'format', 'site', array('id' => $SITE->id));
                      $SITE->format = 'site';
                  }

          Show
          marina Marina Glancy added a comment - I added in upgrade.php : if ($SITE->format !== 'site') { $DB->set_field('course', 'format', 'site', array('id' => $SITE->id)); $SITE->format = 'site'; }
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          Tested here, both with manually "hacked" site and with real server, both upgraded perfectly and the "endless loop" @ upgradesettings.php is not happening anymore.

          So passed, thanks!

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - Tested here, both with manually "hacked" site and with real server, both upgraded perfectly and the "endless loop" @ upgradesettings.php is not happening anymore. So passed, thanks!
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          This has landed upstream, closing, thanks!

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - This has landed upstream, closing, thanks!

            People

            • Votes:
              4 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/Jan/13