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

Notice: Undefined property: stdClass::$defaulthomepage in /var/www/html/moodle/index.php

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.2
    • Fix Version/s: 2.1.6, 2.2.3
    • Component/s: General
    • Labels:
    • Testing Instructions:
      Hide
      1. Login as admin
      2. Enable developer debugging
      3. Remove config "defaulthomepage" from database (using phpmyadmin or any other tool)
      4. click on home page
      5. you should not see any notice, (also keep an eye on error log to make sure no notice/error is generated.)
      Show
      Login as admin Enable developer debugging Remove config "defaulthomepage" from database (using phpmyadmin or any other tool) click on home page you should not see any notice, (also keep an eye on error log to make sure no notice/error is generated.)
    • Affected Branches:
      MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull Master Branch:
      wip-mdl-32270

      Description

      I had upgraded my Moodle site from 1.9 to 2.2.2+.
      After upgrading the site I accessed front page, then I got a notice message "Notice: Undefined property: stdClass::$defaulthomepage in /var/www/html/moodle/index.php" on the top of the front page.
      I didn't use mymoodle on 1.9.

      So, if I change "Debug messages" from NORMAL to NONE, I'll not get the notice message. But now I'm debugging my Moodle2.2.2+ site.

      I modified moodle/index.php as follows for avoiding the notice;

      require_once('config.php');
      require_once($CFG->dirroot .'/course/lib.php');
      require_once($CFG->libdir .'/filelib.php');

      redirect_if_major_upgrade_required();

      $urlparams = array();
      // (Shirai): add from here
      // if (empty($CFG->defaulthomepage)) $CFG->defaulthomepage = NULL;
      // (Shirai): add to here
      if ($CFG->defaulthomepage == HOMEPAGE_MY && optional_param('redirect', 1, PARAM_BOOL) === 0)

      { $urlparams['redirect'] = 0; }

      $PAGE->set_url('/', $urlparams);
      $PAGE->set_course($SITE);

      This modification is not fundamental countermeasure.
      Why $CFG->defaulthomepage does not assigning any value (including NULL)?
      Which process of migrating is assign valid value of $CFG->defaulthomepage?

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              shirai Tatsuya Shirai added a comment -

              Screen shot

              Show
              shirai Tatsuya Shirai added a comment - Screen shot
              Hide
              rajeshtaneja Rajesh Taneja added a comment -

              Thanks for reporting this Tatsuya.

              Attached patch will take care of this.

              Show
              rajeshtaneja Rajesh Taneja added a comment - Thanks for reporting this Tatsuya. Attached patch will take care of this.
              Hide
              salvetore Michael de Raadt added a comment -

              It would be good to know why this is not being set during an upgrade.

              Show
              salvetore Michael de Raadt added a comment - It would be good to know why this is not being set during an upgrade.
              Hide
              phalacee Jason Fowler added a comment -

              Looks good Raj

              Show
              phalacee Jason Fowler added a comment - Looks good Raj
              Hide
              rajeshtaneja Rajesh Taneja added a comment -

              Thanks Jason

              Show
              rajeshtaneja Rajesh Taneja added a comment - Thanks Jason
              Hide
              nebgor Aparup Banerjee added a comment -

              The main moodle.git repository has just been updated (yesterday) with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

              TIA and ciao

              Show
              nebgor Aparup Banerjee added a comment - The main moodle.git repository has just been updated (yesterday) with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
              Hide
              shirai Tatsuya Shirai added a comment -

              I've detected why $CFG->defaulthomepage etc... did not preseted in my upgraded moodle site!
              I'd set a parameter 'debug messages' = 'NORMAL' on Moodle1.9 (Site administration->Server->Debugging),and then executed upgrade process to Moodle2.2.
              After finishing migration from 1.9 to 2.2 Moodle will go to next step, 'Setting new parameters', however my moodle outputed "Coding error"(in red box).
              Maybe I pressed 'Continue' button, then the very important process was skipped! As a natural result $CFG->defaulthomepage and etc... were not created in database.

              Now I retry to access for moodle/admin/index.php, "New settings - Front page settings" is displayed in my web browser!

              Show
              shirai Tatsuya Shirai added a comment - I've detected why $CFG->defaulthomepage etc... did not preseted in my upgraded moodle site! I'd set a parameter 'debug messages' = 'NORMAL' on Moodle1.9 (Site administration->Server->Debugging),and then executed upgrade process to Moodle2.2. After finishing migration from 1.9 to 2.2 Moodle will go to next step, 'Setting new parameters', however my moodle outputed "Coding error"(in red box). Maybe I pressed 'Continue' button, then the very important process was skipped! As a natural result $CFG->defaulthomepage and etc... were not created in database. Now I retry to access for moodle/admin/index.php, "New settings - Front page settings" is displayed in my web browser!
              Hide
              samhemelryk Sam Hemelryk added a comment -

              Thanks Raj, this has been integrated now.

              On an interesting note that whole bit of default home page code in index.php is borked. There is an issue (GSOC) that will see all of that fixed up.

              Cheers
              Sam

              Show
              samhemelryk Sam Hemelryk added a comment - Thanks Raj, this has been integrated now. On an interesting note that whole bit of default home page code in index.php is borked. There is an issue (GSOC) that will see all of that fixed up. Cheers Sam
              Hide
              ankit_frenz Ankit Agarwal added a comment -

              This works as expected.
              passing thanks

              Show
              ankit_frenz Ankit Agarwal added a comment - This works as expected. passing thanks
              Hide
              poltawski Dan Poltawski added a comment -

              Jolly good show!

              Your changes have made it into the Moodle release - its time to celebrate! I suggest a hot cup of English tea (with milk, no sugar) or a hoppy English ale.

              Tally-ho!

              Show
              poltawski Dan Poltawski added a comment - Jolly good show! Your changes have made it into the Moodle release - its time to celebrate! I suggest a hot cup of English tea (with milk, no sugar) or a hoppy English ale. Tally-ho!

                People

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

                  Dates

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