Skip to content

Conversation

sarahjcotton
Copy link
Contributor

This commit is slightly different to the original as we encountered an issue today for a site that had a block that utilises elastic search added to a course page, for which the original fix did not successfully work.

This fix should be slightly more robust in that it checks for optional library file and the function; if those don't exist then it will use the plugin version.

@mark-webster-catalyst
Copy link
Contributor

@Peterburnett Any chance we can move this one along? It impacts all Totara TXP sites and Moodle 4.2.


require __DIR__ . '/Aws/functions.php';
require __DIR__ . '/GuzzleHttp/functions_include.php';
if (!file_exists(__DIR__ . '/../../../../libraries/optional/aws/aws-sdk-php/src/functions.php') && !function_exists('Aws\constantly')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace the morse code with $CFG->libraries

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what stable branches is CFG->libraries supported on?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's in Totara 13+, so maybe just if (!isset($CFG->libraries) && [...] would be more appropriate

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If so make sure the comment is clear saying exactly why its doing this and on what versions


require __DIR__ . '/Aws/functions.php';
require __DIR__ . '/GuzzleHttp/functions_include.php';
if ((!isset($CFG->libraries) && !file_exists($CFG->libraries . '/optional/aws/aws-sdk-php/src/functions.php'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ((!isset($CFG->libraries) && !file_exists($CFG->libraries . '/optional/aws/aws-sdk-php/src/functions.php'))
if ((!isset($CFG->libraries) || !file_exists($CFG->libraries . '/optional/aws/aws-sdk-php/src/functions.php'))

The AND should probably be an OR, otherwise the two statements are mutually inclusive.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Been trying to do this in-between other work but I won't be able to review this week as I'm doing upgrade prep for the rest of the week then on leave next week, so could someone else pick it up perhaps? Happy to give access to my repo for any volunteers.

@zishanj
Copy link

zishanj commented Aug 24, 2023

Librelambda plugin is also affected by this issue. Kindly reinstate asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants