oliviervalentin/moodle-mod_stickynotes

Unable to delete stickynotes module from course

Closed this issue · 8 comments

Execute adhoc task: core_course\task\course_delete_modules
... started 09:21:15. Current memory use 6.9MB.
... used 259 dbqueries
... used 0.66545104980469 seconds
Adhoc task failed: core_course\task\course_delete_modules, The course module 320476 could not be deleted. #0 /var/www/moodle/physics/lib/dml/mysqli_native_moodle_database.php(1212): moodle_database->query_end(false)
#1 /var/www/moodle/physics/lib/dml/moodle_database.php(1394): mysqli_native_moodle_database->get_recordset_sql('SELECT * FROM m...', Array, 0, 0)
#2 /var/www/moodle/physics/lib/dml/moodle_database.php(1342): moodle_database->get_recordset_select('stickynotescolu...', 'stickyid = ?', Array, NULL, '*', 0, 0)
#3 /var/www/moodle/physics/backup/util/dbops/backup_structure_dbops.class.php(53): moodle_database->get_recordset('stickynotescolu...', Array, NULL)
#4 /var/www/moodle/physics/backup/util/structure/backup_nested_element.class.php(359): backup_structure_dbops::get_iterator(Object(backup_nested_element), Array, Object(backup_structure_processor))
#5 /var/www/moodle/physics/backup/util/structure/backup_nested_element.class.php(77): backup_nested_element->get_iterator(Object(backup_structure_processor))
#6 /var/www/moodle/physics/backup/util/structure/backup_nested_element.class.php(107): backup_nested_element->process(Object(backup_structure_processor))
#7 /var/www/moodle/physics/backup/util/structure/backup_nested_element.class.php(107): backup_nested_element->process(Object(backup_structure_processor))
#8 /var/www/moodle/physics/backup/util/structure/backup_nested_element.class.php(107): backup_nested_element->process(Object(backup_structure_processor))
#9 /var/www/moodle/physics/backup/util/plan/backup_structure_step.class.php(97): backup_nested_element->process(Object(backup_structure_processor))
#10 /var/www/moodle/physics/backup/util/plan/base_task.class.php(181): backup_structure_step->execute()
#11 /var/www/moodle/physics/backup/moodle2/backup_activity_task.class.php(222): base_task->execute()
#12 /var/www/moodle/physics/backup/util/plan/base_plan.class.php(178): backup_activity_task->execute()
#13 /var/www/moodle/physics/backup/util/plan/backup_plan.class.php(145): base_plan->execute()
#14 /var/www/moodle/physics/backup/controller/backup_controller.class.php(410): backup_plan->execute()
#15 /var/www/moodle/physics/admin/tool/recyclebin/classes/course_bin.php(136): backup_controller->execute_plan()
#16 /var/www/moodle/physics/admin/tool/recyclebin/lib.php(151): tool_recyclebin\course_bin->store_item(Object(stdClass))
#17 /var/www/moodle/physics/course/lib.php(1052): tool_recyclebin_pre_course_module_delete(Object(stdClass))
#18 /var/www/moodle/physics/course/classes/task/course_delete_modules.php(66): course_delete_module('320476')
#19 /var/www/moodle/physics/lib/cronlib.php(335): core_course\task\course_delete_modules->execute()
#20 /var/www/moodle/physics/lib/cronlib.php(198): cron_run_inner_adhoc_task(Object(core_course\task\course_delete_modules))
#21 /var/www/moodle/physics/admin/cli/adhoc_task.php(131): cron_run_adhoc_tasks(1629872465, 59, true)
#22 {main}

Fixed it by updating the names of the tables (stickynotescolumn & stickynotesnote) in the
mod/stickynotes/backup/moodle2/backup_stickynotes_stepslib.php

$stickynotescolumn->set_source_table('stickynotes_column', array('stickyid' => backup::VAR_ACTIVITYID));
$stickynotesnote->set_source_table('stickynotes_note', array('stickycolid' => backup::VAR_PARENTID));

Please see fix #7

Hi @nadavkav

What is your version ?

I tested and it's ok for me :
Moodle 3.11 (Build: 20210517)
Sticky Notes mod_stickynotes 0.2.1 2021051002

This is my version 2021051002

I am not sure how it works for you, since the table names are missing "_". weird.

Very weird indeed... My mistake ! I will change this right now. Thank you for your help ! I will check the restore file too.

OK merged.

Thank for a beautiful module! our teachers love it 😃