Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last reset is not shown for environments which are set in config.php #198

Open
abias opened this issue Nov 15, 2022 · 0 comments
Open

Last reset is not shown for environments which are set in config.php #198

abias opened this issue Nov 15, 2022 · 0 comments
Labels

Comments

@abias
Copy link
Contributor

abias commented Nov 15, 2022

Prerequisites:

  • We want to use this plugin in a way that all environments are set in config.php so that there isn't any need for manual plugin configuration in the GUI.
  • This bug happens using version 2022011401 from Moodle.org on a Moodle 4.0.x instance.

Steps to reproduce:

  • In config.php of the prod instance, add a configuration like this:
// URL of the prod instance (set it here instead of relying on the magic of the plugin).
$CFG->local_envbar_prodwwwroot = https://prod.mymoodle.org';/

// Secret key to allow communication between non-prod environments and the prod environment.
$CFG->local_envbar_secretkey = 'foobar42';

// Array of existing non-prod environments.
$CFG->local_envbar_items = array(
    array(
        'showtext' => 'TEST', 'matchpattern' => https://test.mymoodle.org',/
        'colourbg' => 'crimson', 'colourtext' => 'white'
    )
);
  • Add the same identical configuration to the test instance.

Expected result:

  • On the test instance, the "last reset" information in the envbar should show the correct last reset date when the instance was last reset from prod.

Actual result:

  • On the test instance, the "last reset" information in the envbar always says "Never been refreshed"
    => even if we reset the test instance with the database from prod
    => and even if I force-set the last refresh time on /local/envbar/last_refresh.php within the test instance.

Analysis:

  • Doing some debugging, I saw that the local_envbar database table is completely empty in both prod and test
  • I also spotted that the code to display the last refresh information in the envbar seems to rely on the fact that the environment is registered in the local_envbar database table.
  • I could confirm that, if I remove the $CFG->local_envbar_items setting from config.php on the test instance and register the test environment manually in the GUI, the last refresh time is shown instantly in the envbar.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants