Invalid subtype directory 'mod/lti/source' detected

Invalid subtype directory 'mod/lti/source' detected

by Mike Henry -
Number of replies: 4
Web server logs across multiple Moodle versions show "invalid subtype directory 'mod/lti/source' detected" in 'D:\inetpub\wwwroot\moodle/mod/lti'." Our installation does have the moodle/mod/lti/source directory but has no files or sub-directories, as we remove the shipped readme.txt and upgrade.txt files for security purposes. Is this the cause of the warning?
Average of ratings: -
In reply to Mike Henry

Re: Invalid subtype directory 'mod/lti/source' detected

by Paul Holden -
Picture of Core developers Picture of Moodle HQ Picture of Moodle Workplace team Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Yes, deleting expected directories is going to cause you problems (as you've found, and reported in MDL-79175)

If this is really for "security purposes" you'd be better looking at the following security recommendations and denying access via your webserver config, rather than deleting stuff: https://docs.moodle.org/402/en/Apache#Hiding_internal_paths
In reply to Paul Holden

Re: Invalid subtype directory 'mod/lti/source' detected

by Mike Henry -
Noted. But the directory does exist, it just does not include the readme.txt and upgrade.txt files included in the Moodle distro.
In reply to Mike Henry

Re: Invalid subtype directory 'mod/lti/source' detected

by Jake Dallimore -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Mike,

The removal of those 2 files inside the mod/lti/source directory, while not recommended, will not cause the error you're seeing there. That failure is caused by the following is_dir() check: https://github.com/moodle/moodle/blob/99a7a7c782f01f7d8e3776d8880804bf12d76899/lib/classes/component.php#L608-L611

I'd probably be looking at the permissions in that directory, or exploring why that call is failing, resulting in the error logging. The mod/lti/service directory is another subplugin directory within LTI and you aren't getting errors for that one, so might be a good comparison point. Noting that I'm on linux and that there may be a subtly different behaviour for is_dir() on windows. Not saying there definitely is, but it's perhaps something worth checking too.

Cheers,