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

Bug (?): When clicking on "Update to version: X.Y", changes to the template are not logged in the configlog report #42

Open
danowar2k opened this issue Mar 2, 2023 · 5 comments

Comments

@danowar2k
Copy link

IS: You click on the button, the template content is replaced with the new version, and no one can then see who clicked the button in the first place.

SHOULD: You click on the button, the template content is replaced using Moodle's config API so that changes (and who clicked the button) are logged to the configlog report.

I hope the categorization as a bug is correct.

@danowar2k
Copy link
Author

danowar2k commented Mar 2, 2023

It's strange, though. Looking at the update button code, it seems that Moodle's set_config is used after all. When could this have happened instead of after clicking the button?

EDIT: Oooh. set_config() itself doesn't even call add_to_config_log()...

@justinhunt
Copy link
Owner

Thanks for following up on that. I wonder why that is the case? I hope it does not affect you poorly

@danowar2k
Copy link
Author

danowar2k commented Mar 2, 2023

Wait...did you change it? Or don't you want to change it?

I still think updating the version should document the changes to the audit log. And to do that I think it would suffice to change:

set_config($fieldname . '_' . $templateindex, $fieldvalue, 'filter_generico');

to

$oldValue = get_config($fieldname . '_' . $templateindex, 'filter_generico');
if ($oldValue != $fieldvalue) {
   add_to_config_log($fieldname . '_' . $templateindex, $fieldvalue, $oldValue, 'filter_generico');
}
set_config($fieldname . '_' . $templateindex, $fieldvalue, 'filter_generico');

@danowar2k
Copy link
Author

Thanks for following up on that. I wonder why that is the case? I hope it does not affect you poorly

Well, we just found out about a change to a template which we now can't trace back to anyone clicking "update", which can be confusing, for sure.

@justinhunt
Copy link
Owner

No I did not change it. Sorry I closed it too quick. Yes I guess we could add it to config log. I was not actually aware of that function or log. I will try and look at it soon.

@justinhunt justinhunt reopened this Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants