Moodle plugins directory: Journal | Moodle.org
Journal
Activities ::: mod_journal
Maintained by Cosmin HERMAN, Adrian Sarmas, Ovidiu Morariu, Paul Neag
This module allows a teacher to ask students to reflect on a particular topic. The students can edit and refine their answer over time.
Latest release:
3762 sites
1k downloads
87 fans
Current versions available: 8
Contributors
Cosmin HERMAN (Lead maintainer)
Adrian Sarmas
Ovidiu Morariu
Paul Neag
David Monllaó: Previous maintainer
Please login to view contributors details and/or to contact them
First of all thanks to the developer of this module for the great work done!
I would like to report a conflict that exists between this module and the GDPR functionality of moodle. If the GDPR functionality is enabled and a user is deleted (after a user request or manually), then the deletion process crashes and it is never completed. The scheduled tasks logs also fill up with every execution of the user_deletion task, failing to complete the process. I had spotted the bug a few months ago when I noticed that the user anonymization/deletion was not being completed.
What I found was that in the classes/privacy/provider.php file, the first two methods do not specify the return type on the method declaration.
A proposed fix, which works in the versions 3.8 and previously, was to add the return value to these two methods, i.e. get_metadata(collection) and get_contexts_for_userid(userid) as follows:
public static function get_metadata(collection $collection) : collection
and
public static function get_contexts_for_userid(int $userid) : contextlist
Below I attach the "corrected" code from the provider.php file
/**
* Returns metadata.
*
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
$collection->add_database_table(
'journal_entries',
[
'userid' => 'privacy:metadata:journal_entries:userid',
'modified' => 'privacy:metadata:journal_entries:modified',
'text' => 'privacy:metadata:journal_entries:text',
'rating' => 'privacy:metadata:journal_entries:rating',
'entrycomment' => 'privacy:metadata:journal_entries:entrycomment',
],
'privacy:metadata:journal_entries'
);
return $collection;
}
/**
* Get the list of contexts that contain user information for the specified user.
*
* @param int $userid The user to search.
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
*/
public static function get_contexts_for_userid(int $userid) : contextlist {
$sql = "
SELECT DISTINCT ctx.id
FROM {%s} fc
JOIN {modules} m
ON m.name = :journal
JOIN {course_modules} cm
ON cm.instance = fc.journal
AND cm.module = m.id
JOIN {context} ctx
ON ctx.instanceid = cm.id
AND ctx.contextlevel = :modlevel
WHERE fc.userid = :userid";
$params = ['journal' => 'journal', 'modlevel' => CONTEXT_MODULE, 'userid' => $userid];
$contextlist = new contextlist();
$contextlist->add_from_sql(sprintf($sql, 'journal_entries'), $params);
return $contextlist;
}
For the 2020091100 version, please update the version.php file with the new version, because it has the old version and does not trigger the moodle database upgrade.
$plugin->version = 2020091100;
Thank you!
The code on github is correct and works fine as an alternate.
I don't think it is just wrong version.php, its missing some fixes, (for example https://github.com/elearningsoftware/moodle-mod_journal/pull/48 is missing). The latest build contains the previous one.
Github version is working fine.
this is wrong distribution, with loop:
$plugin->component = 'mod_journal';
$plugin->version = 2020091100;
$plugin->requires = 2017111300; /* Moodle 3.4 */
$plugin->release = '2.1.0 (Build: 2020091100)';
$plugin->maturity = MATURITY_STABLE;
$plugin->cron = 60;
this is from git and works, no loop:
$plugin->component = 'mod_journal';
$plugin->version = 2020020700;
$plugin->requires = 2013111800; /* Moodle 2.6 */
$plugin->release = '2.0.0 (Build: 2019061600)';
$plugin->maturity = MATURITY_STABLE;
$plugin->cron = 60;
this is in distribution with loop:
$plugin->component = 'mod_journal';
$plugin->version = 2020091100;
$plugin->requires = 2017111300; /* Moodle 3.4 */
$plugin->release = '2.1.0 (Build: 2020091100)';
$plugin->maturity = MATURITY_STABLE;
$plugin->cron = 60;
this is from git and installs ok
$plugin->component = 'mod_journal';
$plugin->version = 2020020700;
$plugin->requires = 2013111800; /* Moodle 2.6 */
$plugin->release = '2.0.0 (Build: 2019061600)';
$plugin->maturity = MATURITY_STABLE;
$plugin->cron = 60;