Skip to content

Deprecated function get_system_context() still used in index.php #17

Description

@saidisalem

File: index.php
Line: 57
Affected Moodle version: 4.4+

The deprecated function get_system_context() is still being used in index.php with a version check:

if ($CFG->branch >= 25) { // Moodle 2.5+.
    $context = context_system::instance();
} else {
    $context = get_system_context();
}

This condition is now outdated and unsafe:

  • Moodle 2.5 is no longer supported.
  • get_system_context() has been entirely removed, and will now throw a fatal exception in Moodle 4.4+.

Suggested fix
Simplify the conditional logic by removing the legacy fallback:
$context = context_system::instance();
No version check is required anymore.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions