Add-ons
  1. Add-ons
  2. CONTRIB-1090

Adding item to Sharing Cart generates fatal error

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.9.4
    • Fix Version/s: None
    • Component/s: Block: Sharing cart
    • Labels:
      None
    • Environment:
      FreeBSD 7, php 5, mysql, 5. Catalyst GIT version of Moodle 1.9.4+ HEAD
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_19_STABLE
    • Rank:
      21284

      Description

      Adding any item, whether Resource or Activity, to Sharing cart gives following error:

      exception 'SharingCart_Exception' with message 'Zip creation failure' in /usr/local/www/apache22/data/moo-cat/blocks/sharing_cart/shared/SharingCart_Backup.php:224 Stack trace: #0 /usr/local/www/apache22/data/moo-cat/blocks/sharing_cart/shared/SharingCart_Backup.php(211): SharingCart_Backup->createZip() #1 /usr/local/www/apache22/data/moo-cat/blocks/sharing_cart/backup.php(49): SharingCart_Backup->execute() #2

      {main}

      This is replicatable in my setup. I have the following 3rd party modules installed:

      • Attendance
      • Book
      • OU Wiki
      • Feedback
        Blocks:
      • YUI Course Menu (uses AJAX)

        Activity

        Hide
        Mark Pearson added a comment -

        Just to point out that ZIP does work fine on my system – course restore functions well.
        Also, I looked in sharing_cart/shared/SharingCart_Backup.php and there were some wierd characters embedded in the code:

        58 // <E3><82><B3><E3><82><A2><E3><83><A9><E3><82><A4><E3><83><96><E3><83><A9><E3><83>
        58 <AA><E3><81><8C>HTML<E3><82><92><E5><87><BA><E5><8A><9B><E3><81><97><E3><81><AA><E3><81><84><E3><82> 58 <88><E3><81><86><E3><81><AB><E3><82><B5><E3><82><A4><E3><83><AC><E3><83><B3><E3><83><88><E3><83><A2> 58 <E3><83><BC><E3><83><89><E3><81><AB><E3><81><99><E3><82><8B>

        I'm not sure whether these are deliberate but they occur everywhere throughout files in the shared directory. I checked out the CVS version of sharing_cart and found then same thing. Are these characters meant to be there or is there some sort of virus?

        Show
        Mark Pearson added a comment - Just to point out that ZIP does work fine on my system – course restore functions well. Also, I looked in sharing_cart/shared/SharingCart_Backup.php and there were some wierd characters embedded in the code: 58 // <E3><82><B3><E3><82><A2><E3><83><A9><E3><82><A4><E3><83><96><E3><83><A9><E3><83> 58 <AA><E3><81><8C>HTML<E3><82><92><E5><87><BA><E5><8A><9B><E3><81><97><E3><81><AA><E3><81><84><E3><82> 58 <88><E3><81><86><E3><81><AB><E3><82><B5><E3><82><A4><E3><83><AC><E3><83><B3><E3><83><88><E3><83><A2> 58 <E3><83><BC><E3><83><89><E3><81><AB><E3><81><99><E3><82><8B> I'm not sure whether these are deliberate but they occur everywhere throughout files in the shared directory. I checked out the CVS version of sharing_cart and found then same thing. Are these characters meant to be there or is there some sort of virus?
        Hide
        Ann Adamcik added a comment -

        We just installed sharing cart on 1.9.4+ (build 20090303). It works great when logged in as an admin, but teachers trying to use it in their courses were getting the above exception. With debugging on, the following warning appears as well:

        Warning: copy(/moodle/data/mfab/user/0/5/shared-20090310-095638.zip) [function.copy]: failed to open stream: No such file or directory in /moodle/htdocs/mfab/backup/lib.php on line 281

        I tried turning ajax off in the user's profile - copying to the cart then started working. I turned ajax back on and it continued to work.

        Show
        Ann Adamcik added a comment - We just installed sharing cart on 1.9.4+ (build 20090303). It works great when logged in as an admin, but teachers trying to use it in their courses were getting the above exception. With debugging on, the following warning appears as well: Warning: copy(/moodle/data/mfab/user/0/5/shared-20090310-095638.zip) [function.copy] : failed to open stream: No such file or directory in /moodle/htdocs/mfab/backup/lib.php on line 281 I tried turning ajax off in the user's profile - copying to the cart then started working. I turned ajax back on and it continued to work.
        Hide
        Akio Ohnishi added a comment -

        Dear Pearson

        Sorry, that code is Japanese Comments.
        Sharing cart programmer is two Japanese.

        Show
        Akio Ohnishi added a comment - Dear Pearson Sorry, that code is Japanese Comments. Sharing cart programmer is two Japanese.
        Hide
        Akio Ohnishi added a comment -

        Dear Adamcik

        Sharing cart was not check to exists user directory.
        We changed this function.
        Please update Sharing cart from CVS.

        Show
        Akio Ohnishi added a comment - Dear Adamcik Sharing cart was not check to exists user directory. We changed this function. Please update Sharing cart from CVS.
        Hide
        Mark Pearson added a comment -

        I downloaded the CVS code and did an update. Copied into the blocks folder and ran admin/index.html. Tables created correctly.
        However, when I tried to add any item (resource, feedback, book, whatever) I got exactly the same error as before:

        exception 'SharingCart_Exception' with message 'Zip creation failure' in /usr/local/www/apache22/data/moo-cat/blocks/sharing_cart/shared/SharingCart_Backup.php: 224 Stack trace: #0 /usr/local/www/apache22/data/moo-cat/blocks/sharing_cart/shared/SharingCart_Backup.php(211): SharingCart_Backup->createZip() #1 /usr/local/www/apache22/data/moo-cat/blocks/sharing_cart/backup.php(49): SharingCart_Backup->execute() #2

        {main}

        Tried logging in as user instead of administrator but same error.
        On a hunch went to Site administration : Appearance : AJAX and Javascript and set :

        • Enable AJAX : off (uncheck)
        • Disable AJAX course settings : On (check)

        Still same error when attempt to add item to sharing cart.

        Show
        Mark Pearson added a comment - I downloaded the CVS code and did an update. Copied into the blocks folder and ran admin/index.html. Tables created correctly. However, when I tried to add any item (resource, feedback, book, whatever) I got exactly the same error as before: exception 'SharingCart_Exception' with message 'Zip creation failure' in /usr/local/www/apache22/data/moo-cat/blocks/sharing_cart/shared/SharingCart_Backup.php: 224 Stack trace: #0 /usr/local/www/apache22/data/moo-cat/blocks/sharing_cart/shared/SharingCart_Backup.php(211): SharingCart_Backup->createZip() #1 /usr/local/www/apache22/data/moo-cat/blocks/sharing_cart/backup.php(49): SharingCart_Backup->execute() #2 {main} Tried logging in as user instead of administrator but same error. On a hunch went to Site administration : Appearance : AJAX and Javascript and set : Enable AJAX : off (uncheck) Disable AJAX course settings : On (check) Still same error when attempt to add item to sharing cart.
        Hide
        Akio Ohnishi added a comment -

        Dear Pearson

        We are checking Sharing cart source code.
        Please wait a day.

        Show
        Akio Ohnishi added a comment - Dear Pearson We are checking Sharing cart source code. Please wait a day.
        Hide
        Akio Ohnishi added a comment -

        Dear Pearson

        I updated Sharing Cart source codes to CVS.
        But, I can't find a problem completely.
        Maybe, directory permission,,,

        So, I added a new copy function and output more error messages.
        Please update and tell me result.

        Show
        Akio Ohnishi added a comment - Dear Pearson I updated Sharing Cart source codes to CVS. But, I can't find a problem completely. Maybe, directory permission,,, So, I added a new copy function and output more error messages. Please update and tell me result.
        Hide
        Mark Pearson added a comment -

        I tried changing permissions and ownership and was flummoxed when I got the same error. So I checked to see whether ZIP actually worked by attempting to zip a bunch of files (I had tested unzip before) and it did not. So I took a look at Site Administration : System Paths and path to zip was set to /usr/local/bin/zip but when I checked it, the zip binary was not there. So, there you have it --the error messages were generated because the system could not find the zip binary – mea culpa and many apologies. To create the program I just did /usr/ports/archivers/zip]$ make install clean and the source was downloaded and compiled – the wonders of FreeBSD!

        I have tested the code with Activities such as OUWiki and it seems to work fine. Will do some more testing. So, apologies once again – this was never a bug!

        Show
        Mark Pearson added a comment - I tried changing permissions and ownership and was flummoxed when I got the same error. So I checked to see whether ZIP actually worked by attempting to zip a bunch of files (I had tested unzip before) and it did not. So I took a look at Site Administration : System Paths and path to zip was set to /usr/local/bin/zip but when I checked it, the zip binary was not there. So, there you have it --the error messages were generated because the system could not find the zip binary – mea culpa and many apologies. To create the program I just did /usr/ports/archivers/zip]$ make install clean and the source was downloaded and compiled – the wonders of FreeBSD! I have tested the code with Activities such as OUWiki and it seems to work fine. Will do some more testing. So, apologies once again – this was never a bug!
        Hide
        Don Hinkelman added a comment -

        Dear Sharing Cart Users,

        If you are using the Sharing Cart, please download a new version from Moodle CVS added today-20090414.
        http://download.moodle.org/download.php/plugins/blocks/sharing_cart.zip

        Our Version2 Educational Web Development colleagues fixed a bug with restoring/deleting old items that was caused by
        some missing DB update operation codes in previous version of the Sharing Cart--a similar error message that Mark reported earlier.

        Also I have updated the Sharing Cart documentation concerning how to share questions in the Question Bank. I recommend creating new roles for teachers and using System question categories. Correct me if you have some other experience concerning this. Please let me know as soon as possible.
        http://docs.moodle.org/en/Sharing_Cart

        Roles (new documentation)
        Generally, the Sharing Cart will duplicate any activity in any course that a teacher has access to. However, quiz questions have another set of permissions independent of site roles. Therefore, we recommend if you wish to share questions, make the following changes:
        1. Add a new role--Question Creator: Make this role in Site Admin >> Users >> Permissions >> Define roles, and assign all teachers to this role (in addition to other roles they already have). This role should be given at least the following rights (set permissions to "Allow") under "Course": Manage Activities, Manage Files,Add new questions, Edit all questions, Edit question categories, Move all questions, Use all questions, View all questions.
        2. Set questions to System Question Category: If you set questions to course or activity level categories, you may not be able to share them.
        3. Possibly add another role--Question User: If students are unable to view questions, make this role and assign all students to this role. Set to "Allow" the following permissions: Use all questions, View all questions.

        Show
        Don Hinkelman added a comment - Dear Sharing Cart Users, If you are using the Sharing Cart, please download a new version from Moodle CVS added today-20090414. http://download.moodle.org/download.php/plugins/blocks/sharing_cart.zip Our Version2 Educational Web Development colleagues fixed a bug with restoring/deleting old items that was caused by some missing DB update operation codes in previous version of the Sharing Cart--a similar error message that Mark reported earlier. Also I have updated the Sharing Cart documentation concerning how to share questions in the Question Bank. I recommend creating new roles for teachers and using System question categories. Correct me if you have some other experience concerning this. Please let me know as soon as possible. http://docs.moodle.org/en/Sharing_Cart Roles (new documentation) Generally, the Sharing Cart will duplicate any activity in any course that a teacher has access to. However, quiz questions have another set of permissions independent of site roles. Therefore, we recommend if you wish to share questions, make the following changes: 1. Add a new role--Question Creator: Make this role in Site Admin >> Users >> Permissions >> Define roles, and assign all teachers to this role (in addition to other roles they already have). This role should be given at least the following rights (set permissions to "Allow") under "Course": Manage Activities, Manage Files,Add new questions, Edit all questions, Edit question categories, Move all questions, Use all questions, View all questions. 2. Set questions to System Question Category: If you set questions to course or activity level categories, you may not be able to share them. 3. Possibly add another role--Question User: If students are unable to view questions, make this role and assign all students to this role. Set to "Allow" the following permissions: Use all questions, View all questions.

          People

          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development