udima-university/moodle-mod_jitsi

Error on v3.2 upgrade

Closed this issue · 2 comments

Hi, when trying to upgrade from jitsi 3.1.2 2021090100 to latest 3.2 2022040800 I've seen a fatal DB error on two servers (3.9 and 4.0RC), and none on other (3.9). The error blocks upgrade sequence and prevents upgrading of other plugins.

db/upgrade.php line 207 missing id in $onprivatesessionloggedin
$DB->update_record('config_plugins', $onprivatesessionloggedin);

It seems that depending on previous history upgrade the message_provider_mod_jitsi_onprivatesession_loggedxx properties may NOT exists on DB.

I've patched that db/upgrade.php section as

    if($onprivatesessionloggedin = $DB->get_record('config_plugins', array('name' =>
        'message_provider_mod_jitsi_onprivatesession_loggedin'))) {
        $onprivatesessionloggedin->value = 'airnotifier,popup';
        $DB->update_record('config_plugins', $onprivatesessionloggedin);            
    }
    if($onprivatesessionloggedoff = $DB->get_record('config_plugins', array('name' =>
        'message_provider_mod_jitsi_onprivatesession_loggedoff'))) {
        $onprivatesessionloggedoff->value = 'airnotifier,popup';            
        $DB->update_record('config_plugins', $onprivatesessionloggedoff);
    }

But perhaps you want to ensure those properties do exist on DB.

Best regards
Enrique Castro

Hola Enrique,
thanks for your feedback.
Your patch would work, and it would not have major consequences because there I am only changing default options for notifications. But I don't know why you don't have those variables saved in the database and I want to make sure why before I add your solution to the code.
(Luckily I had a problem uploading the zip to moodle's plugin directory and it has saved me from many people having this problem. hehe)

Hi Enrique,
I hadn't considered that if and admin disable notifications in admin/messages.php the record in the database disappears. I have added your conditional to the code.
Gracias!