donhinkelman / moodle-block_sharing_cart

Content sharing plug-in for Moodle LMS. Now at version 4.4, release 3 (actually this is for Moodle LMS version 4.3. Requires PHP 7.4.
7 stars 38 forks source link

error after updating sharing cart version 2020090100 - moodle 3.6.3 #90

Closed vancouverdeveloper closed 3 years ago

vancouverdeveloper commented 3 years ago

So on our test instance, we are running php 7.0.x with mysql 5.7.x and moodle version 3.6.3 on a shared hosting provider

I upgraded the sharing cart (2020090100) as moodle plugin suggested :-) to version and now all the 150 courses that have that cart cannot be accessed and all I get is the error message

Exception - syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE)
Debug info:
Error code: generalexceptionmessage
Stack trace:
line 42 of /blocks/sharing_cart/classes/controller.php: ParseError thrown
line ? of unknownfile: call to core_component::classloader()
line 87 of /blocks/sharing_cart/block_sharing_cart.php: call to spl_autoload_call()
line 321 of /blocks/moodleblock.class.php: call to block_sharing_cart->get_content()
line 230 of /blocks/moodleblock.class.php: call to block_base->formatted_contents()
line 1216 of /lib/blocklib.php: call to block_base->get_content_for_output()
line 1268 of /lib/blocklib.php: call to block_manager->create_block_contents()
line 604 of /lib/outputrenderers.php: call to block_manager->ensure_content_created()
line 39 of /theme/bootstrapbase/renderers/core_renderer.php: call to core_renderer->standard_head_html()
line 44 of /theme/clean/layout/columns3.php: call to theme_bootstrapbase_core_renderer->standard_head_html()
line 1328 of /lib/outputrenderers.php: call to include()
line 1258 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
line 244 of /course/view.php: call to core_renderer->header()

The funny thing is that I made a back up of a course and created new course that had a sharing cart plugin BEFORE upgrading the Sharing Cart plugin and I can view that newly created course, which had the older sharing cart version.

How and where can I troubleshoot this?

Thanks!

donhinkelman commented 3 years ago

Hi Larry, I am guessing there is a conflict with your Moodle 3.6.3 and the Sharing Cart 2020090100 version you have updated to. I am sorry about that because it means you should not have been asked to upgrade. Did you upgrade directly from github or from the Moodle Plugins database? Could you share with me the message you got that asked you to upgrade? I don't know how to fix this, so I will ask Sam or Johnny for advice here. If your whole Moodle is paralyzed, you could remove the sharing cart, reinstall with an older version of Sharing Cart, and see if that resolves the problem.

donhinkelman commented 3 years ago

Looking at the Moodle Plugins database for Sharing Cart here: https://moodle.org/plugins/pluginversions.php?plugin=block_sharing_cart

I found the latest Sharing Cart available there to be 2020090100, which is out of date. So I released a new version, SC 3.9, release 3. Please update to that version 2021031300 and tell me if that solves your problem.

vancouverdeveloper commented 3 years ago

Thank you Don. Will this work for version 3.6.3?

How do I upgrade it? Can I just delete the existing one in the /block folder; then upload the new one and go to Moodle - Notifications and it will update it automatically?

thanks

vancouverdeveloper commented 3 years ago

Hi Larry, I am guessing there is a conflict with your Moodle 3.6.3 and the Sharing Cart 2020090100 version you have updated to. I am sorry about that because it means you should not have been asked to upgrade. Did you upgrade directly from github or from the Moodle Plugins database? Could you share with me the message you got that asked you to upgrade? I don't know how to fix this, so I will ask Sam or Johnny for advice here. If your whole Moodle is paralyzed, you could remove the sharing cart, reinstall with an older version of Sharing Cart, and see if that resolves the problem.

I upgraded it via the moodle plugin. and the course can be accessed if I hide it.. if I delete, it will delete it from all the courses that use that plugin no?

vancouverdeveloper commented 3 years ago

Just upgraded it by replacing the entire folder and unfortunately.. still same error

donhinkelman commented 3 years ago

You don't have to delete anything, just upgrade. This is how I upgrade:
1) download zip file from plugins database or github; the file should look like this (or take this file):
moodle-block_sharing_cart-master.zip 2) go to your site administration >> plugins >> install plugins 3) drag the zip folder into the window of install plugins 4) click the install button or whatever button is there.
That should do it. Tell me how it works.

donhinkelman commented 3 years ago

If this does not work, you might try installing the much older version of Sharing Cart-- 3.8, release 3 Go here: https://moodle.org/plugins/pluginversions.php?plugin=block_sharing_cart

vancouverdeveloper commented 3 years ago

I had to delete all the associated tables with sharing cart and that seem to have done the trick for the older version at least and still with php 7.0.33... I will upgrade it as I read in the docs, the class controller is only supported in version 7.1.x and above.

thanks again @donhinkelman

donhinkelman commented 3 years ago

Hi and I hope this issue is solved for you. I will leave it open for the moment awaiting advice from Johnny as to whether I need to post a warning about past versions of php. As I understand, you have discovered that the Sharing Cart (2020090100) has an issue with php versions older than 7.1.x, which now supports class controllers.

mcardle commented 3 years ago

Hi Don...

I think you should post the warning as 7.0, 7.1 and 7.2 for that matter, are deprecated versions of PHP and should not be used anyway.

Kind regards

Ulrik McArdle Head of department @ Praxis

donhinkelman commented 3 years ago

Thanks, Ulrik. That is very helpful information and I will post a warning that PHP version 7.2 and older are deprecated, and will cause problems, unrelated to the Sharing Cart, such as badges.