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

Web installation is not working

    XMLWordPrintable

Details

    • MOODLE_400_STABLE
    • MOODLE_400_STABLE
    • Hide

      Temporarily comment the following lines in lib/setup.php file (once the installation is done, you can uncomment them again):

      // Load any immutable bootstrap config from local cache.
      $bootstrapcachefile = $CFG->localcachedir . '/bootstrap.php';
      if (is_readable($bootstrapcachefile)) {
       try {
         require_once($bootstrapcachefile);
       } catch (Throwable $e) {
         // If it is corrupted then attempt to delete it and it will be rebuilt.
         @unlink($bootstrapcachefile);
       }
      }

      Show
      Temporarily comment the following lines in lib/setup.php file (once the installation is done, you can uncomment them again): // Load any immutable bootstrap config from local cache. $bootstrapcachefile = $CFG->localcachedir . '/bootstrap.php' ; if (is_readable($bootstrapcachefile)) { try { require_once($bootstrapcachefile); } catch (Throwable $e) { // If it is corrupted then attempt to delete it and it will be rebuilt. @unlink ($bootstrapcachefile); } }
    • Hide

      Prerequisite

      1. Ensure that the dataroot directory to be used for the installation of the site is 100% empty.
      2. Ensure that the testing instructions following start before patch, aka, without the current patch applied (pointing to moodle.git insted of integration.git, for example).

      Web install (this issue testing)

      1. Verify that you are before patch.
      2. Install a new site from scratch (any database is ok) vía web.
      3. Once the installation is completed, go to the site configured dataroot directory (CFG->dataroot in config.php file).
      4. Verify that there is a localcache/bootstrap,php file.
      5. Verify that the file looks like this (ignoring values "x"):

        <?php
        // ********** This file is generated DO NOT EDIT **********
        $CFG->siteidentifier = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx';
        define('SYSCONTEXTID', x;
        

      6. Copy that file elsewhere (out from dataroot). Lets name the "OLDFILE"
      7. Switch to after patch (pointing to the same site but now using the code already @ integration.git.
      8. Visit any page in the site.
      9. Verify that there is still a localcache/bootstrap,php file @ dataroot.
      10. Verify that the file has changed and looks like this (ignoring values "x"):

        <?php
        // ********** This file is generated DO NOT EDIT **********
        $CFG->siteidentifier = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx';
        $CFG->bootstraphash = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx';
        // Only if the file is not stale and has not been defined.
        if ($CFG->bootstraphash === hash_local_config_cache() && !defined('SYSCONTEXTID')) {
            define('SYSCONTEXTID', x);
        }
        

      11. Copy that file elsewhere (out from dataroot). Lets name the "NEWFILE"
      12. Delete (rm) the localcache/bootstrap,php file.
      13. Visit any page in the site again.
      14. Verify that the dataroot localcache/bootstrap,php has been regenerated.
      15. Verify that its contents are EXACTLY the same than the "NEWFILE" ones. All the values (siteidentifier, bootstraphash, SYSCONTEXTID) should be the same than the ones in "NEWFILE".
      16. Edit config.php and change the $CFG->prefix to be different (for example, from mdl_ to mdr_ or anything similar).
      17. Verify that the Moodle Installation / Copyright page is displayed without any error.
      18. Verify that the dataroot localcache/bootstrap,php has been removed.
      19. Continue with the web install.
      20. Verify that the dataroot localcache/bootstrap,php file still has NOT been regenerated when viewing the Environmental checks page. Continue.
      21. Wait for all the tables to be created.
      22. Verify that, as soon as all the tables have been created, the dataroot localcache/bootstrap,php is back (has been regenerated).
      23. Verify that it looks like the one in step 10 (ignoring values).
      24. Compare it with the "NEWFILE" and verify that the values (siteidentifier, bootstraphash) have changed.
      25. Copy that file elsewhere (out from dataroot). Lets name the "FINALFILE"
      26. Continue with the installation (create admin user, site settings...) until the end.
      27. Play a little bit with the site (create a course, a user...). Spend 1-2 minutes doing "things".
      28. Verify that the dataroot localcache/bootstrap.php file is still there.
      29. Verify that it has not been modified since 1-2 minutes ago.
      30. Verify that its contents are 100% the same than the "FINALFILE" one.

      CLI install (regression testing)

      1. Verify that you are after patch.
      2. Ensure that you're using a dataroot DIFFERENT from the one used for testing the WEB install above.
      3. Install a new site from scratch (any database is ok) vía CLI.
      4. Verify that the process ends ok and without errors.
      5. Visit it
      6. Verify that it works ok (creating a course...)
      7. Edit config.php and change the $CFG->prefix to be different (for example, from mdl_ to mdr_ or anything similar).
      8. Install a new site again (any database is ok) vía CLI.
      9. Verify that the process ends ok and without errors.
      10. Visit it
      11. Verify that it works ok (creating a course...)
      12. Verify that the dataroot localcache/bootstrap.php exists.
      13. Verify that it looks like this (ignoring values):

        <?php
        // ********** This file is generated DO NOT EDIT **********
        $CFG->siteidentifier = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx';
        $CFG->bootstraphash = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx';
        // Only if the file is not stale and has not been defined.
        if ($CFG->bootstraphash === hash_local_config_cache() && !defined('SYSCONTEXTID')) {
            define('SYSCONTEXTID', x);
        }
        

      14. Party! :-D
      Show
      Prerequisite Ensure that the dataroot directory to be used for the installation of the site is 100% empty. Ensure that the testing instructions following start before patch , aka, without the current patch applied (pointing to moodle.git insted of integration.git, for example). Web install (this issue testing) Verify that you are before patch . Install a new site from scratch (any database is ok) vía web. Once the installation is completed, go to the site configured dataroot directory ( CFG->dataroot in config.php file). Verify that there is a localcache/bootstrap,php file. Verify that the file looks like this (ignoring values "x"): <?php // ********** This file is generated DO NOT EDIT ********** $CFG->siteidentifier = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx'; define('SYSCONTEXTID', x; Copy that file elsewhere (out from dataroot). Lets name the "OLDFILE" Switch to after patch (pointing to the same site but now using the code already @ integration.git. Visit any page in the site. Verify that there is still a localcache/bootstrap,php file @ dataroot. Verify that the file has changed and looks like this (ignoring values "x"): <?php // ********** This file is generated DO NOT EDIT ********** $CFG->siteidentifier = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx'; $CFG->bootstraphash = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx'; // Only if the file is not stale and has not been defined. if ($CFG->bootstraphash === hash_local_config_cache() && !defined('SYSCONTEXTID')) { define('SYSCONTEXTID', x); } Copy that file elsewhere (out from dataroot). Lets name the "NEWFILE" Delete (rm) the localcache/bootstrap,php file. Visit any page in the site again. Verify that the dataroot localcache/bootstrap,php has been regenerated. Verify that its contents are EXACTLY the same than the "NEWFILE" ones. All the values (siteidentifier, bootstraphash, SYSCONTEXTID) should be the same than the ones in "NEWFILE". Edit config.php and change the $CFG->prefix to be different (for example, from mdl_ to mdr_ or anything similar). Verify that the Moodle Installation / Copyright page is displayed without any error. Verify that the dataroot localcache/bootstrap,php has been removed. Continue with the web install. Verify that the dataroot localcache/bootstrap,php file still has NOT been regenerated when viewing the Environmental checks page. Continue. Wait for all the tables to be created. Verify that, as soon as all the tables have been created, the dataroot localcache/bootstrap,php is back (has been regenerated). Verify that it looks like the one in step 10 (ignoring values). Compare it with the "NEWFILE" and verify that the values (siteidentifier, bootstraphash) have changed. Copy that file elsewhere (out from dataroot). Lets name the "FINALFILE" Continue with the installation (create admin user, site settings...) until the end. Play a little bit with the site (create a course, a user...). Spend 1-2 minutes doing "things". Verify that the dataroot localcache/bootstrap.php file is still there. Verify that it has not been modified since 1-2 minutes ago. Verify that its contents are 100% the same than the "FINALFILE" one. CLI install (regression testing) Verify that you are after patch . Ensure that you're using a dataroot DIFFERENT from the one used for testing the WEB install above. Install a new site from scratch (any database is ok) vía CLI. Verify that the process ends ok and without errors. Visit it Verify that it works ok (creating a course...) Edit config.php and change the $CFG->prefix to be different (for example, from mdl_ to mdr_ or anything similar). Install a new site again (any database is ok) vía CLI. Verify that the process ends ok and without errors. Visit it Verify that it works ok (creating a course...) Verify that the dataroot localcache/bootstrap.php exists. Verify that it looks like this (ignoring values): <?php // ********** This file is generated DO NOT EDIT ********** $CFG->siteidentifier = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx'; $CFG->bootstraphash = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx'; // Only if the file is not stale and has not been defined. if ($CFG->bootstraphash === hash_local_config_cache() && !defined('SYSCONTEXTID')) { define('SYSCONTEXTID', x); } Party! :-D

    Description

      MDL-71014 has caused regression and now installation using the web UI is not working properly (it's working as expected using CLI).

      Steps to reproduce:

      1. Install a clean Moodle site, based on master.
      2. Edit the config.php file and change $CFG->prefix (for instance, to "x").
      3. Open your Moodle site in a web browser.

      Expected behaviour:

      • The installation process starts and the "Have you read these conditions and understood them?" message is displayed. 

      Current behaviour:

      • An error is displayed:
        • In some cases: "Error reading from database"
        • In other cases: 

       

      !!! Table "course" does not exist !!!
      Debug info: 
      Error code: ddltablenotexist
      Stack trace: * line 665 of /lib/dml/moodle_database.php: dml_exception thrown
      * line 1621 of /lib/dml/moodle_database.php: call to moodle_database->where_clause()
      * line 578 of /lib/datalib.php: call to moodle_database->get_record()
      * line 778 of /lib/setup.php: call to get_site()
      * line 29 of /config.php: call to require_once()
      * line 28 of /admin/cli/purge_caches.php: call to require()
      

       

      Attachments

        Issue Links

          Activity

            People

              stronk7 Eloy Lafuente (stronk7)
              sarjona Sara Arjona (@sarjona)
              Sara Arjona (@sarjona) Sara Arjona (@sarjona)
              Shamim Rezaie Shamim Rezaie
              Angelia Dela Cruz Angelia Dela Cruz
              Matteo Scaramuccia, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                19/Apr/22

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 6 hours
                  6h