Moodle
  1. Moodle
  2. MDL-26273

Impossible to import questions from GIFT or Moodle XML files into Lesson (2.0)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Not a bug
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Component/s: Lesson
    • Affected Branches:
      MOODLE_20_STABLE
    • Rank:
      15879

      Description

      Impossible to import questions from GIFT or Moodle XML files into Lesson (2.0).
      Getting error messages:
      Warning: mysqli::real_escape_string() expects parameter 1 to be string, array given in \moodle\lib\dml\mysqli_native_moodle_database.php on line 661
      See http://moodle.org/mod/forum/discuss.php?d=167980

        Issue Links

          Activity

          Hide
          Helen Foster added a comment -

          Joseph, thanks for your report. I notice that the forum discussion has an example GIFT file attached.

          Show
          Helen Foster added a comment - Joseph, thanks for your report. I notice that the forum discussion has an example GIFT file attached.
          Hide
          Petr Škoda added a comment -

          eh, this is going to be a lot of work, seems like somebody changed the question format API without thinking much about lesson code...

          Show
          Petr Škoda added a comment - eh, this is going to be a lot of work, seems like somebody changed the question format API without thinking much about lesson code...
          Hide
          Tim Lock added a comment -

          Feedback on 2.1.6 with Question / Lesson importing.

          Importing of that gift export isn't liked by Moodle for some reason.

          Course > Question -> Import -> GIFT :

          Import questions from file
          Import
          The type of the file you selected (document/unknown) does not match the type expected by this import format (text/plain).

          BUT works from within Lesson.

          Import questions
          Importing 10 questions

          Show
          Tim Lock added a comment - Feedback on 2.1.6 with Question / Lesson importing. Importing of that gift export isn't liked by Moodle for some reason. Course > Question -> Import -> GIFT : Import questions from file Import The type of the file you selected (document/unknown) does not match the type expected by this import format (text/plain). BUT works from within Lesson. Import questions Importing 10 questions
          Hide
          Jean-Michel Vedrine added a comment -

          Hello Tim,
          Your problem is not related to the present issue (MDL-26273) but is somewhat related to MDL-28364.
          But MDL-28364 is fixed since Moodle 2.1.5, so most probably your file don't have the right extension.
          For a gift file the extension should be .txt because as the error message said a text/plain file is expected. Rename your file and try again to import it.
          It works with lesson because lesson is using a different (older) code that don't verify the mimetype of the file.

          Show
          Jean-Michel Vedrine added a comment - Hello Tim, Your problem is not related to the present issue ( MDL-26273 ) but is somewhat related to MDL-28364 . But MDL-28364 is fixed since Moodle 2.1.5, so most probably your file don't have the right extension. For a gift file the extension should be .txt because as the error message said a text/plain file is expected. Rename your file and try again to import it. It works with lesson because lesson is using a different (older) code that don't verify the mimetype of the file.
          Hide
          Jean-Michel Vedrine added a comment -

          By the way, I just discovered this issue (Mdl-26273). Joseph can you tell me if it is fixed or not ? if this is still a problem, I can have a look at it, seems pretty similar to the changes already done in question code .

          Show
          Jean-Michel Vedrine added a comment - By the way, I just discovered this issue (Mdl-26273). Joseph can you tell me if it is fixed or not ? if this is still a problem, I can have a look at it, seems pretty similar to the changes already done in question code .
          Hide
          Joseph Rézeau added a comment -

          Import of GIFT and Moodle XML questions into Lesson works fine with current Moodle 2.3.

          Show
          Joseph Rézeau added a comment - Import of GIFT and Moodle XML questions into Lesson works fine with current Moodle 2.3.
          Hide
          Rajesh Taneja added a comment -

          Hello Joseph,

          It seems this issue has been fixed. Shall we close this issue or you are still facing this issue on (any) 2.x branch?

          Show
          Rajesh Taneja added a comment - Hello Joseph, It seems this issue has been fixed. Shall we close this issue or you are still facing this issue on (any) 2.x branch?
          Hide
          Joseph Rézeau added a comment -

          The issue is fixed on 2.3.

          Show
          Joseph Rézeau added a comment - The issue is fixed on 2.3.
          Hide
          Rajesh Taneja added a comment -

          Thanks Joseph,

          Closing this issue as it's not a bug anymore.

          Show
          Rajesh Taneja added a comment - Thanks Joseph, Closing this issue as it's not a bug anymore.

            People

            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: