What is /local/externserverfile.php ??

What is /local/externserverfile.php ??

by Howard Miller -
Number of replies: 5
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I the url resource, lives this bit of code:

function url_get_encrypted_parameter($url, $config) {
    global $CFG;

    if (file_exists("$CFG->dirroot/local/externserverfile.php")) {
        require_once("$CFG->dirroot/local/externserverfile.php");
        if (function_exists('extern_server_file')) {
            return extern_server_file($url, $config);
        }
    }
    return md5(getremoteaddr().$config->secretphrase);
}

What is /local/externserverfile.php that it is trying to find. I can't find it documented anywhere. 

Average of ratings: -
In reply to Howard Miller

Re: What is /local/externserverfile.php ??

by Steven Mao -

Hi Howard,

This is probably a file left by another developer who worked on your Moodle code. Maybe try to run grep -r -l 'url_get_encrypted_parameter' moodledirectory to see which files call this function?

Someone please correct if I am wrong but the /local directory is supposed to be where one installs local plugins and should be empty with a clean installation, except for a readme.txt file I believe.

Hope this helps!

Mao

In reply to Steven Mao

Re: What is /local/externserverfile.php ??

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Thanks but no it isn't. 'git blame' shows it was part of the original commit of the new 'url' resource written by Petr Skoda quite some time ago. 

You are right - local/ does not ship with any plugins at all. However, the above is in core code and is looking for a file in local/ with a specific name and then a specific function within that file. Typically, it won't find a file of course. 

In reply to Howard Miller

Re: What is /local/externserverfile.php ??

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

heh - deja vu...

https://moodle.org/mod/forum/discuss.php?d=181219

No idea though....

In reply to Dan Marsden

Re: What is /local/externserverfile.php ??

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Ha! I'd forgotten - with a bit more research I discovered it was actually the same client asking me much the same question at the time. 

They wanted to modify the way the 'secretphrase' feature works and that looked like some form of candidate.