Restore with user's data fails in 2.4+

Restore with user's data fails in 2.4+

by Antonio Crespo -
Number of replies: 5

Good afternoon,

 

I Have Moodle 2.4+ running in CentOS. I have this challenge: Two teachers are using the same course with different groups according to the teacher's sections. Somehow, teachers failed to give clear instructions to students, who are all confused and ended completing activities for both teachers... a complete caos that I am trying to solve by creating two separate courses, one for each of the teachers, each with their own students. So I need to have a new course created with part of the enrolled students along wiht their data. I have created a full backup of the course and when I try to restore, I choose to include the user's data and to enroll user's as manual enrollments, but the process ends with the following error:

Debug info: Data too long for column 'url' at row 1
INSERT INTO mdl_log (time,userid,ip,module,action,url,info,course,cmid) VALUES(?,?,?,?,?,?,?,?,?)
[array (
0 => 1362353428,
1 => '1981',
2 => '186.65.91.37',
3 => 'forum',
4 => 'search',
5 => 'search.php?id=223&search=Role+of+libraries+in+literacy+development+forumid%3A516+user%3Ayesenia+us...',
6 => 'Role of libraries in literacy development forumid:516 user:yesenia user:Cruz +UB +Library -ago -whenever "move from the computers and video games" datefrom:946706400',
7 => 223,
8 => 0,
)]
Error code: dmlwriteexception
Stack trace:
  • line 429 of /lib/dml/moodle_database.php: dml_write_exception thrown
  • line 1107 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 1149 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
  • line 2265 of /backup/moodle2/restore_stepslib.php: call to mysqli_native_moodle_database->insert_record()
  • line 131 of /backup/util/plan/restore_structure_step.class.php: call to restore_course_logs_structure_step->process_log()
  • line 103 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process()
  • line 125 of /backup/util/xml/parser/processors/grouped_parser_processor.class.php: call to restore_structure_parser_processor->dispatch_chunk()
  • line 91 of /backup/util/helper/restore_structure_parser_processor.class.php: call to grouped_parser_processor->postprocess_chunk()
  • line 148 of /backup/util/xml/parser/processors/simplified_parser_processor.class.php: call to restore_structure_parser_processor->postprocess_chunk()
  • line 92 of /backup/util/xml/parser/processors/progressive_parser_processor.class.php: call to simplified_parser_processor->process_chunk()
  • line 169 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser_processor->receive_chunk()
  • line 253 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->publish()
  • line ? of unknownfile: call to progressive_parser->end_tag()
  • line 158 of /backup/util/xml/parser/progressive_parser.class.php: call to xml_parse()
  • line 137 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->parse()
  • line 105 of /backup/util/plan/restore_structure_step.class.php: call to progressive_parser->process()
  • line 153 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
  • line 163 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
  • line 157 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
  • line 315 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
  • line 147 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
  • line 46 of /backup/restore.php: call to restore_ui->execute()
I will appreciate any ideas as how to solve this situation. Thanks in advance.
 
Antonio
 
Average of ratings: -
In reply to Antonio Crespo

Re: Restore with user's data fails in 2.4+

by Ken Task -
Picture of Particularly helpful Moodlers

The mdl_log URL field has varchar(100) setting.  Evidently, there is a record that has too much data in it or it's being incorrectly read when an attempt to import.

You've not mentioned if you are remotely hosted or not - shared system, so the following, if remotely hosted, may not apply.

Since server is CentOS (and if NOT remotely hosted - shared system), strongly suggest installing Webmin (http://www.webmin.com) - the .tar.gz.

Webmin has a MySQL tool that will allow one to search and edit tables in the Moodle DB for the 2.4.  In Webmin, MySQL DB, DB for your Moodle, mdl_log table, search for the IP address seen in the output above (186.65.91.37) using the ip field.

One can delete any and all logs from that IP address OR the row you see with a lot of data in the url field.  Safe to delete ... it's just a log of what users did.

If one cannot install webmin and is remotely hosted, is there any tool you have to work with the DB?  phpmyadmin or other.  Use it to do the same - DB for Moodle - mdl_log table - ip address column search for that IP.  Remove record that has the most amount of data in the 'url' field or all references in the mdl_log table for that IP.

Then backup the course again and attempt another restore.

'spirit of sharing', Ken

In reply to Ken Task

Re: Restore with user's data fails in 2.4+

by Antonio Crespo -

Thanks Ken and Lawrence for your prompt response and your advise about using Webmin and Toad for MySQL, which looks like impressive tools.

Even though our Moodle is hosted remotely, we have full control over it, so using phpmyadmin would have solved my problem.

Luckily, for the second copy of the course I did not need this forum, so I created a backup of the course without including this specific forum and restored in a new course. Now I have the 2 courses as I needed, each lecturer has his course resources and materials and students are enrolled only to the course section they registered for.

In other words, I have solved my problem. Thanks a lot for your support.

 

Regards, Antonio

In reply to Antonio Crespo

Re: Restore with user's data fails in 2.4+

by Lawrence N -

Phpmyadmin would do the trick too. similar to webmin and Toad.

Still I would increase the column/field size just in case in the future, the problem comes up again.

In reply to Antonio Crespo

Re: Restore with user's data fails in 2.4+

by Ken Task -
Picture of Particularly helpful Moodlers

Glad you have it resolved - good thinking.  However, if that record in mdl_log is still in the original course, backups of that course might still have issues should you ever need to restore it - ie, the problem is still there waiting.  IMHO, fix it now while it's fresh on your mind. smile

'spirit of sharing', Ken

In reply to Antonio Crespo

Re: Restore with user's data fails in 2.4+

by Lawrence N -

Ken is correct. Your URL field looks too be too short for the data you want to enter.

You can also use Toad for MySQL.

http://www.quest.com/toad-for-mysql/

But as Ken mentioned, we have to know if your moodle is hosted internally or through a provider. If through a provider, they may already have tools you can use to alter the field's column size through their preferred interface.

Your URL is long:

102 characters

"'search.php?id=223&search=Role+of+libraries+in+literacy+development+forumid%3A516+user%3Ayesenia+us..."

http://www.lettercount.com/