Forums | Mahara Community

Developers /
"admin\users\bulkimport.php" error in generated file name?


12 August 2019, 5:57

Hello all,

I'm not sure if I should be posting this comment to this forums, or if its a bug that I should be submitting to a dedicated tracker system; please let me know.

I'm using Mahara 19.04.1. I'm interested in the bulkimport.php functionality so I can set up my Mahara development instance in a repeatable fashion. I'd manually set up a user (called 'user1') and export the users entire portfolio as a LEAP2A file locally. Following the instructions on the bulkimport.php file, I combined the LEAP2A into a zip archive with a "usernames.csv" to map 'user1' to the LEAP2A file.

When I tried to import it using bulkimport.php, I got the following error:

Import failed for 1 of 1 users.

  • user1: Failed to unzip the Leap2A file /var/www/mahara_data/import/1/1565545295//users/mahara-export-leap-user2-2019-08-11_15-59_b1QwA5afVdxqEPKN.zip. See the error log for more information.

The problem is in the middle of the path; the "//users/" part, this isn't reflected in the filesystem of mahara_data.

I could fix the problem by editing the bulkimport.php here:

Line 139:
     $LEAP2AFILES[$username] = "$importdir/users/$filename";

If I remove the '/users' part, the problem is fixed.

Corrected Line 139:
     $LEAP2AFILES[$username] = "$importdir/$filename";

 But, I wasn't expecting to have to do this, so I think I've done something wrong in my setup. Can someone advise me?

Thanks,

Guillaume

Robert Lyon's profile picture
Posts: 708

12 August 2019, 9:29

Hi Guillaume,

I think the problem is both the double path slash '//' in the import and the instructions on the page that are not quite clear.

I've created a patch to clear these things up

https://reviews.mahara.org/#/c/10258/

When it comes to bulk import the file structure in you import.zip file should be:

import.zip

|_  usernames.csv

|_  users

      |_  mahara-export-leap-user2-2019-08-11_15-59_b1QwA5afVdxqEPKN.zip

 

Cheers

Robert

16 August 2019, 8:20

Hello Robert,

 

Thank you for getting back to me so quickly... and apologies for responding to you so late.

You are (obviously) correct that if I put my LEAP2A files in a subdirectory called 'users' within the zip archive, everything imports find.

 

Thank you for your help,

Guillaume

3 results