Leap2a: Importing a file artefact has failed

Bug #1594192 reported by Son Nguyen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Unassigned
18.04
Fix Released
Medium
Unassigned
18.10
Fix Released
Medium
Unassigned

Bug Description

Version: master (16.10), 16.04, 15.10

For some reasons, the attribute mtime of a file artefact in a leap2a file is empty. This cause the following error when import it.

[WAR] fc (lib/errors.php:796) Failed to get a recordset: postgres8 error: [-1: ERROR: invalid input syntax for type timestamp: ""] in adodb_throw(UPDATE "artefact" SET "artefacttype" = ? , "container" = ? , "parent" = ? , "owner" = ? , "institution" = ? , "group" = ? , "ctime" = ? , "mtime" = ? , "atime" = ? , "locked" = ? , "title" = ? , "description" = ? , "note" = ? , "author" = ? , "authorname" = ? , "allowcomments" = ? , "approvecomments" = ? , "license" = ? , "licensor" = ? , "licensorurl" = ? , "path" = ? WHERE "id" = ? , file,0,60,1,,,2016-06-2010:17:24,,2016-06-2010:17:24,0,MasterofEducationtranscript,,,1,,0,0,,,,/60/61,61), referer: http://192.168.2.47:8080/mahara/master/htdocs/import/index.php?action=1
[Mon Jun 20 10:17:24.948612 2016] [:error] [pid 11881] [client 192.168.2.47:33369] [WAR] fc (lib/errors.php:796) Command was: UPDATE "artefact" SET "artefacttype" = ? , "container" = ? , "parent" = ? , "owner" = ? , "institution" = ? , "group" = ? , "ctime" = ? , "mtime" = ? , "atime" = ? , "locked" = ? , "title" = ? , "description" = ? , "note" = ? , "author" = ? , "authorname" = ? , "allowcomments" = ? , "approvecomments" = ? , "license" = ? , "licensor" = ? , "licensorurl" = ? , "path" = ? WHERE "id" = ? and values was (0:file,1:0,2:60,3:1,4:,5:,6:2016-06-2010:17:24,7:,8:2016-06-2010:17:24,9:0,10:MasterofEducationtranscript,11:,12:,13:1,14:,15:0,16:0,17:,18:,19:,20:/60/61,21:61), referer: http://192.168.2.47:8080/mahara/master/htdocs/import/index.php?action=1
[Mon Jun 20 10:17:24.948629 2016] [:error] [pid 11881] [client 192.168.2.47:33369] Call stack (most recent first):, referer: http://192.168.2.47:8080/mahara/master/htdocs/import/index.php?action=1
[Mon Jun 20 10:17:24.948633 2016] [:error] [pid 11881] [client 192.168.2.47:33369] * log_message("Failed to get a recordset: postgres8 error: [-1: E...", 8, true, true) at /var/www/html/mahara/master/htdocs/lib/errors.php:95, referer: http://192.168.2.47:8080/mahara/master/htdocs/import/index.php?action=1
[Mon Jun 20 10:17:24.948638 2016] [:error] [pid 11881] [client 192.168.2.47:33369] * log_warn("Failed to get a recordset: postgres8 error: [-1: E...") at /var/www/html/mahara/master/htdocs/lib/errors.php:796, referer: http://192.168.2.47:8080/mahara/master/htdocs/import/index.php?action=1
[Mon Jun 20 10:17:24.948642 2016] [:error] [pid 11881] [client 192.168.2.47:33369] * SQLException->__construct("Failed to get a recordset: postgres8 error: [-1: E...") at /var/www/html/mahara/master/htdocs/lib/dml.php:1302, referer: http://192.168.2.47:8080/mahara/master/htdocs/import/index.php?action=1
[Mon Jun 20 10:17:24.948646 2016] [:error] [pid 11881] [client 192.168.2.47:33369] * update_record("artefact", object(stdClass), "id") at /var/www/html/mahara/master/htdocs/artefact/lib.php:628, referer: http://192.168.2.47:8080/mahara/master/htdocs/import/index.php?action=1
[Mon Jun 20 10:17:24.948649 2016] [:error] [pid 11881] [client 192.168.2.47:33369] * ArtefactType->commit() at /var/www/html/mahara/master/htdocs/artefact/file/lib.php:1062, referer: http://192.168.2.47:8080/mahara/master/htdocs/import/index.php?action=1
[Mon Jun 20 10:17:24.948653 2016] [:error] [pid 11881] [client 192.168.2.47:33369] * ArtefactTypeFile->commit() at /var/www/html/mahara/master/htdocs/artefact/file/import/leap/lib.php:499, referer: http://192.168.2.47:8080/mahara/master/htdocs/import/index.php?action=1
[Mon Jun 20 10:17:24.948657 2016] [:error] [pid 11881] [client 192.168.2.47:33369] * LeapImportFile::create_file_from_entry_data(object(stdClass), object(PluginImportLeap), "portfolio:artefact148") at /var/www/html/mahara/master/htdocs/artefact/file/import/leap/lib.php:421, referer: http://192.168.2.47:8080/mahara/master/htdocs/import/index.php?action=1
[Mon Jun 20 10:17:24.948661 2016] [:error] [pid 11881] [client 192.168.2.47:33369] * LeapImportFile::create_file_from_request(object(PluginImportLeap), object(stdClass), 60) at /var/www/html/mahara/master/htdocs/artefact/file/import/leap/lib.php:94, referer: http://192.168.2.47:8080/mahara/master/htdocs/import/index.php?action=1
[Mon Jun 20 10:17:24.948667 2016] [:error] [pid 11881] [client 192.168.2.47:33369] * LeapImportFile::import_from_requests(object(PluginImportLeap)) at Unknown:0, referer: http://192.168.2.47:8080/mahara/master/htdocs/import/index.php?action=1
[Mon Jun 20 10:17:24.948670 2016] [:error] [pid 11881] [client 192.168.2.47:33369] * call_user_func_array(array(size 2), array(size 1)) at /var/www/html/mahara/master/htdocs/lib/mahara.php:1714, referer: http://192.168.2.47:8080/mahara/master/htdocs/import/index.php?action=1
[Mon Jun 20 10:17:24.948675 2016] [:error] [pid 11881] [client 192.168.2.47:33369] * call_static_method("LeapImportFile", "import_from_requests", object(PluginImportLeap)) at /var/www/html/mahara/master/htdocs/import/leap/lib.php:299, referer: http://192.168.2.47:8080/mahara/master/htdocs/import/index.php?action=1
[Mon Jun 20 10:17:24.949820 2016] [:error] [pid 11881] [client 192.168.2.47:33369] * PluginImportLeap->call_import_method_plugins("import_from_requests") at /var/www/html/mahara/master/htdocs/import/leap/lib.php:314, referer: http://192.168.2.47:8080/mahara/master/htdocs/import/index.php?action=1
[Mon Jun 20 10:17:24.949837 2016] [:error] [pid 11881] [client 192.168.2.47:33369] * PluginImportLeap->do_import_from_requests() at /var/www/html/mahara/master/htdocs/import/index.php:311, referer: http://192.168.2.47:8080/mahara/master/htdocs/import/index.php?action=1
[Mon Jun 20 10:17:24.949846 2016] [:error] [pid 11881] [client 192.168.2.47:33369] * do_import() at /var/www/html/mahara/master/htdocs/import/index.php:71, referer: http://192.168.2.47:8080/mahara/master/htdocs/import/index.php?action=1

Tags: export import
Revision history for this message
Son Nguyen (ngson2000) wrote :

We need to make sure $data->mtime is valid before assign it to $artefact at line #472, htdocs/artefact/file/import/leap/lib.php.

tags: added: export import
Changed in mahara:
milestone: none → 16.10.0
importance: Undecided → Medium
Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

When the export was attempted again, the following warning message was displayed on the admin homepage:

PHP on your website host does not return a useful value for the timezone identifier (%z) - certain date formatting, such as the Leap2A export, will be broken. %z is a PHP date formatting code. This problem is usually due to a limitation in running PHP on Windows.

Robert Lyon (robertl-9)
Changed in mahara:
milestone: 16.10.0 → 16.10.1
Robert Lyon (robertl-9)
Changed in mahara:
milestone: 16.10.1 → 17.04.0
Robert Lyon (robertl-9)
Changed in mahara:
milestone: 17.04.0 → 17.10.0
Robert Lyon (robertl-9)
Changed in mahara:
milestone: 17.10.0 → 18.04.0
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/8590

Robert Lyon (robertl-9)
Changed in mahara:
status: Confirmed → In Progress
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/8590
Committed: https://git.mahara.org/mahara/mahara/commit/8bdba9ff170db53d1917057b33f7f3f3c29462a8
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 8bdba9ff170db53d1917057b33f7f3f3c29462a8
Author: Robert Lyon <email address hidden>
Date: Thu Mar 8 10:39:17 2018 +1300

Bug 1594192: Setting the mtime to 'now' if not valid time string

for leap2a artefact import

behatnotneeded

Change-Id: Ib87c051c824c56a732d02ce83a5a6f0811e1df37
Signed-off-by: Robert Lyon <email address hidden>

Robert Lyon (robertl-9)
Changed in mahara:
status: In Progress → Fix Committed
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "18.04_STABLE" branch: https://reviews.mahara.org/8657

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/8657
Committed: https://git.mahara.org/mahara/mahara/commit/107fba4cc5b950c223f00501246d230f73a3fbbd
Submitter: Robert Lyon (<email address hidden>)
Branch: 18.04_STABLE

commit 107fba4cc5b950c223f00501246d230f73a3fbbd
Author: Robert Lyon <email address hidden>
Date: Thu Mar 8 10:39:17 2018 +1300

Bug 1594192: Setting the mtime to 'now' if not valid time string

for leap2a artefact import

behatnotneeded

Change-Id: Ib87c051c824c56a732d02ce83a5a6f0811e1df37
Signed-off-by: Robert Lyon <email address hidden>
(cherry picked from commit 8bdba9ff170db53d1917057b33f7f3f3c29462a8)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.