From: moodler Date: Mon, 10 Jan 2005 15:26:43 +0000 (+0000) Subject: New and upgraded sites will be given a default .htaccess file in their X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=2765411a34d3ca4d35c5efea3a88ee8f7f3496a8;p=moodle.git New and upgraded sites will be given a default .htaccess file in their dataroot directory SC#64 --- diff --git a/lib/db/mysql.php b/lib/db/mysql.php index 1f2dcac732..e6eef77ce2 100644 --- a/lib/db/mysql.php +++ b/lib/db/mysql.php @@ -1092,6 +1092,17 @@ function main_upgrade($oldversion=0) { modify_database('', "INSERT INTO prefix_log_display VALUES ('message', 'block contact', 'user', 'CONCAT(firstname,\" \",lastname)'); "); modify_database('', "INSERT INTO prefix_log_display VALUES ('message', 'unblock contact', 'user', 'CONCAT(firstname,\" \",lastname)'); "); } + + if ($oldversion < 2005011000) { // Create a .htaccess file in dataroot, just in case + if (!file_exists($CFG->dataroot.'/.htaccess')) { + if ($handle = fopen($CFG->dataroot.'/.htaccess', 'w')) { // For safety + @fwrite($handle, "deny from all\r\n"); + @fclose($handle); + notify("Created a default .htaccess file in $CFG->dataroot"); + } + } + } + return $result; } diff --git a/lib/db/postgres7.php b/lib/db/postgres7.php index 7452d98cf8..9367c836c7 100644 --- a/lib/db/postgres7.php +++ b/lib/db/postgres7.php @@ -868,6 +868,16 @@ function main_upgrade($oldversion=0) { "); } + if ($oldversion < 2005011000) { // Create a .htaccess file in dataroot, just in case + if (!file_exists($CFG->dataroot.'/.htaccess')) { + if ($handle = fopen($CFG->dataroot.'/.htaccess', 'w')) { // For safety + @fwrite($handle, "deny from all\r\n"); + @fclose($handle); + notify("Created a default .htaccess file in $CFG->dataroot"); + } + } + } + return $result; } diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 31bd9e115b..fcb190cbe1 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -2567,6 +2567,10 @@ function make_upload_directory($directory, $shownotices=true) { } return false; } + if ($handle = fopen($currdir.'/.htaccess', 'w')) { // For safety + @fwrite($handle, "deny from all\r\n"); + @fclose($handle); + } } $dirarray = explode('/', $directory); diff --git a/version.php b/version.php index 4841f05b45..e2a5c22d3c 100644 --- a/version.php +++ b/version.php @@ -6,7 +6,7 @@ // This is compared against the values stored in the database to determine // whether upgrades should be performed (see lib/db/*.php) - $version = 2005010100; // YYYYMMDD = date of first major branch release 1.4 + $version = 2005011000; // YYYYMMDD = date of first major branch release 1.4 // XY = increments within a single day $release = '1.5 UNSTABLE DEVELOPMENT'; // Human-friendly version name