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

Fresh install should be possible with some removed plugins

XMLWordPrintable

    • MOODLE_404_STABLE
    • MOODLE_405_STABLE
    • MDL-82359-main
    • Hide

      This test script requires that you have a project set up so that you can run PHPunit and Behat on it (with necessary prefix etc defined in config.php).

      1 Remove selected plugins entirely (note that this is quite an arbitrary list. it is the one I'm currently testing with at the OU):

      rm -r mod/bigbluebuttonbn mod/book mod/chat mod/choice mod/data mod/feedback mod/forum mod/h5pactivity mod/lesson mod/survey mod/wiki
       
      rm -r blocks/activity_modules blocks/admin_bookmarks blocks/badges blocks/blog_menu blocks/blog_recent blocks/blog_tags blocks/calendar_month blocks/calendar_upcoming blocks/comments blocks/completionstatus blocks/course_list blocks/course_summary blocks/feedback blocks/globalsearch blocks/glossary_random blocks/login blocks/lp blocks/mentees blocks/mnet_hosts blocks/myprofile blocks/news_items blocks/online_users blocks/private_files blocks/recent_activity blocks/recentlyaccessedcourses blocks/recentlyaccesseditems blocks/rss_client blocks/search_forums blocks/section_links blocks/selfcompletion blocks/site_main_menu blocks/social_activities blocks/starredcourses blocks/tag_flickr blocks/tags blocks/tag_youtube blocks/timeline
       
      rm -r media/player/videojs
       
      rm -r filter/data filter/mathjaxloader filter/mediaplugin
       
      rm -r payment/gateway/paypal
       
      rm -r admin/tool/analytics admin/tool/behat admin/tool/mfa
      

      2 Run phpunit init:

      php admin/tool/phpunit/cli/init.php
      

      • Expected: Init completes, reaching the line 'PHPUnit test environment setup complete.' without errors or warnings.

      NOTE: We do not expect that if you actually run PHPunit at this point it will succeed. Unit tests are entitled to assume that the default plugins exist, so there will be lots of errors and failures. However, the install part should complete, which would allow for specific test suites (that are known not to have dependencies on the deleted plugins) to be run.

      3 Put back all the missing plugins that were deleted in step 1 (for example by using a git command to restore them) so that you have a complete, normal Moodle installation.

      4 The next step is to do a fresh Moodle install that you can use to test. If you have a Behat setup that you can access in a browser, then the easiest way to do this is using Behat as follows:

      php admin/tool/behat/cli/util.php --drop
      php admin/tool/behat/cli/init.php
      

      Any other way to install a fresh Moodle instance including this code would also be fine, such as temporarily changing your database prefix and dataroot in config.php.

      5 Once the site is completely installed, in your web browser, visit the site (if you are using the Behat install, remember that this will be the URL of the behat site not your normal URL) and log in as admin (if you are using Behat, the password for admin user is also 'admin').

      6 Look at the dashboard page /my/ (this should be where you get after login).

      • Expected (no change): The 'Recently accessed items' block is present on the right.

      7 Create a new course (Site administration / Courses / Add a new course), and select the Social course format, which has a default block. Type any name for the required fields and leave other options default.

      • Expected (no change): On the created coures, the 'Social activities' block is present on the right.

      8 Go to Site administration / Grades / Scales.

      • Expected (no change): The 'Separate and connected ways of knowing' scale should be present with following options shown: 'Mostly separate knowing, Separate and connected, Mostly connected knowing'.

      9 Go to Site administration / General / Analytics / Analytics models and find the 'Students at risk of dropping out' model. Click on the 'Number of indicators' link to expand it.

      • Expected (no change): The number of indicators should be large, currently 49. It should include options for many of the plugin modules such as 'Book cognitive' and 'Book social'.

      10 Go to Site administration / Appearance / Themes and click the Select theme button next to the Classic theme.

      11 Go to Site administration / Users / Accounts / Browse list of users and press Add a new user (this is because you have to have a different user, not admin user who is currently logged in).

      12 Complete required form fields with any values and submit the form.

      13 Click on the name of the newly-created user to view their profile.

      • Expected (no change): The Navigation block at the left should contain a bullet list starting with the name of the user you selected. Within that list there should be an expandable Forum posts option. If you expand it there should be options Posts and Discussions. These links should take you to pages within the forum module which say '...has made no posts' and '...has made no discussions' respectively (these pages were not changed).
      Show
      This test script requires that you have a project set up so that you can run PHPunit and Behat on it (with necessary prefix etc defined in config.php). 1 Remove selected plugins entirely (note that this is quite an arbitrary list. it is the one I'm currently testing with at the OU): rm -r mod/bigbluebuttonbn mod/book mod/chat mod/choice mod/data mod/feedback mod/forum mod/h5pactivity mod/lesson mod/survey mod/wiki   rm -r blocks/activity_modules blocks/admin_bookmarks blocks/badges blocks/blog_menu blocks/blog_recent blocks/blog_tags blocks/calendar_month blocks/calendar_upcoming blocks/comments blocks/completionstatus blocks/course_list blocks/course_summary blocks/feedback blocks/globalsearch blocks/glossary_random blocks/login blocks/lp blocks/mentees blocks/mnet_hosts blocks/myprofile blocks/news_items blocks/online_users blocks/private_files blocks/recent_activity blocks/recentlyaccessedcourses blocks/recentlyaccesseditems blocks/rss_client blocks/search_forums blocks/section_links blocks/selfcompletion blocks/site_main_menu blocks/social_activities blocks/starredcourses blocks/tag_flickr blocks/tags blocks/tag_youtube blocks/timeline   rm -r media/player/videojs   rm -r filter/data filter/mathjaxloader filter/mediaplugin   rm -r payment/gateway/paypal   rm -r admin/tool/analytics admin/tool/behat admin/tool/mfa 2 Run phpunit init: php admin/tool/phpunit/cli/init.php Expected: Init completes, reaching the line 'PHPUnit test environment setup complete.' without errors or warnings. NOTE: We do not expect that if you actually run PHPunit at this point it will succeed. Unit tests are entitled to assume that the default plugins exist, so there will be lots of errors and failures. However, the install part should complete, which would allow for specific test suites (that are known not to have dependencies on the deleted plugins) to be run. 3 Put back all the missing plugins that were deleted in step 1 (for example by using a git command to restore them) so that you have a complete, normal Moodle installation. 4 The next step is to do a fresh Moodle install that you can use to test. If you have a Behat setup that you can access in a browser, then the easiest way to do this is using Behat as follows: php admin/tool/behat/cli/util.php --drop php admin/tool/behat/cli/init.php Any other way to install a fresh Moodle instance including this code would also be fine, such as temporarily changing your database prefix and dataroot in config.php. 5 Once the site is completely installed, in your web browser, visit the site (if you are using the Behat install, remember that this will be the URL of the behat site not your normal URL) and log in as admin (if you are using Behat, the password for admin user is also 'admin'). 6 Look at the dashboard page /my/ (this should be where you get after login). Expected (no change): The 'Recently accessed items' block is present on the right. 7 Create a new course ( Site administration / Courses / Add a new course ), and select the Social course format, which has a default block. Type any name for the required fields and leave other options default. Expected (no change): On the created coures, the 'Social activities' block is present on the right. 8 Go to Site administration / Grades / Scales . Expected (no change): The 'Separate and connected ways of knowing' scale should be present with following options shown: 'Mostly separate knowing, Separate and connected, Mostly connected knowing'. 9 Go to Site administration / General / Analytics / Analytics models and find the 'Students at risk of dropping out' model. Click on the 'Number of indicators' link to expand it. Expected (no change): The number of indicators should be large, currently 49. It should include options for many of the plugin modules such as 'Book cognitive' and 'Book social'. 10 Go to Site administration / Appearance / Themes and click the Select theme button next to the Classic theme. 11 Go to Site administration / Users / Accounts / Browse list of users and press Add a new user (this is because you have to have a different user, not admin user who is currently logged in). 12 Complete required form fields with any values and submit the form. 13 Click on the name of the newly-created user to view their profile. Expected (no change): The Navigation block at the left should contain a bullet list starting with the name of the user you selected. Within that list there should be an expandable Forum posts option. If you expand it there should be options Posts and Discussions . These links should take you to pages within the forum module which say '...has made no posts' and '...has made no discussions' respectively (these pages were not changed).

      If your institution does not use certain standard plugins (e.g. book, forum) at the moment it is not possible to install Moodle without those plugins. You can install Moodle, then remove the plugins, but a fresh install gives errors.

      This causes problems if you are trying to, for example, run unit tests on your codebase (after removing the plugins) - the errors cause the 'init' script to crash out.

      By testing with a somewhat arbitrary large list of plugins to delete, so far I have identified the following problems:

      1 If mod_forum is not available then install gives warnings in lib/db/upgradelib.php function make_default_scale because it relies on language strings from forum.

      2 If mod_book (and a host of others) are not available then install gives warnings when installing analytics models, because the models defined in lib/db/analytics.php refer to various classes within modules which do not exist.

      3 lib/upgradelib.php calls blocks_add_default_course_blocks and blocks_add_default_system_blocks. Both functions fail if any default blocks do not exist.

      No doubt there are other problems with specific plugins that I didn't try to uninstall, but I think if we limit the scope of this issue to the ones I tested, other problems can be fixed in other issues later.

      For those wondering why we would like to uninstall standard modules, this came about because somebody ran a carbon analyser that said our javascript is really big, so we want to remove some unused plugins in order to avoid killing too many dolphins. 🐬 Tests indicate that by removing a whole stack of plugins we can save approximately 7% of dolphins JavaScript size.There is also a security benefit (reduced footprint) in removing unused code, even if the code is supposed to be disabled.

            quen Sam Marshall
            quen Sam Marshall
            Tim Hunt Tim Hunt
            Andrew Lyons Andrew Lyons
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 42 minutes
                1h 42m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.