Skip to content

Conversation

@alexdamsted
Copy link

@alexdamsted alexdamsted commented Aug 28, 2025

This PR is trying to solve a bug in issue #225 where the get_directory_size core Totara/Moodle function throws a fatal exception in Totara sites. Moodle has newer code for the function that would resolve this for Totara but to avoid core hacks this PR does a code fork and adds compatibility for Totara.

Replication steps:

  1. Access /report/performance/index.php to see the fatal exception.
  2. The following condition must pass in get_directory_size:
    if (!empty($CFG->pathtodu) && is_executable(trim($CFG->pathtodu))
  3. The following dirs do not end with a '/' where ever they are set:
    $allowedbasedirs = array( $CFG->dataroot, $CFG->localcachedir, $CFG->tempdir, $CFG->cachedir, $CFG->dirroot );

@alexdamsted alexdamsted self-assigned this Aug 28, 2025
@alexdamsted alexdamsted force-pushed the MOODLE_39_STABLE-totara-compatibility-bug-get-directory-size branch from 04c1961 to 1d1be80 Compare August 28, 2025 03:52
@alexdamsted alexdamsted force-pushed the MOODLE_39_STABLE-totara-compatibility-bug-get-directory-size branch 7 times, most recently from 9d4cffc to c0c6c4b Compare September 3, 2025 17:23
@alexdamsted alexdamsted force-pushed the MOODLE_39_STABLE-totara-compatibility-bug-get-directory-size branch 3 times, most recently from 49c670a to b0d6ecf Compare September 5, 2025 09:31
@alexdamsted alexdamsted force-pushed the MOODLE_39_STABLE-totara-compatibility-bug-get-directory-size branch 2 times, most recently from cc60c33 to 4661925 Compare September 11, 2025 01:42
@alexdamsted alexdamsted force-pushed the MOODLE_39_STABLE-totara-compatibility-bug-get-directory-size branch from 4661925 to 5d2ed00 Compare September 11, 2025 03:09
@dmitriim dmitriim merged commit 6c99679 into MOODLE_39_STABLE Sep 11, 2025
31 of 33 checks passed
@dmitriim dmitriim deleted the MOODLE_39_STABLE-totara-compatibility-bug-get-directory-size branch September 11, 2025 03:16
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.

3 participants