How To Disable Data Directory Check in Moodle 3.3+ Installation

How To Disable Data Directory Check in Moodle 3.3+ Installation

by Ultra Max -
Number of replies: 1

Hello Dear Friends...

I have problem of installing the Moodle 3.3+ On my host..

Moodle can't create Data Directory outside of public_html.. 

I contacted to server Administrator and and asked about this issue... They said that it was blocked for the security reason..

So then I decided to change the data directory location.. but install wizard says: "Dataroot location is not secure".. I created the "moodledata" directory in the public_html and chmoded it with "770" and also put there .htaccess file with: order deny,allow deny from all, but the result is the same, can't install...

Now I want to disable data directory check in Moodle installation (of course on my own risk)..

Please help how to disable it (I want moodledata directory inside my public_html)

here is the code where it checks the data directory..


//first time here? find out suitable dataroot


if (is_null($CFG->dataroot)) {

    $CFG->dataroot = __DIR__.'/../moodledata';


    $i = 0; //safety check - dirname might return some unexpected results

    while(is_dataroot_insecure()) {

        $parrent = dirname($CFG->dataroot);

        $i++;

        if ($parrent == '/' or $parrent == '.' or preg_match('/^[a-z]:\\\?$/i', $parrent) or ($i > 100)) {

            $CFG->dataroot = ''; //can not find secure location for dataroot

            break;

        }

        $CFG->dataroot = dirname($parrent).DIRECTORY_SEPARATOR.'moodledata';

    }

    $config->dataroot = $CFG->dataroot;

    $config->stage    = INSTALL_WELCOME;

}


What to change how to disable it..

Thank you very much in Advanced!



Average of ratings: -
In reply to Ultra Max

Re: How To Disable Data Directory Check in Moodle 3.3+ Installation

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

Don't!

Fix your .htaccess so it works properly. Ask you administrator. Not all sites use and/or enable .htaccess.

It's a massive security hole leaving the data folder web accessible. 

Even better... find a different host.

Average of ratings: Useful (1)