Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'w51_MDL-30621_m22_protectdir' of git://github.com/skoda…

…k/moodle into MOODLE_22_STABLE
  • Loading branch information...
commit e79c09855ca853fab61d88b3f8d2a71e1fc8411b 2 parents b750cfd + f9c5bd9
Sam Hemelryk samhemelryk authored

Showing 1 changed file with 12 additions and 2 deletions. Show diff stats Hide diff stats

  1. +12 2 lib/setuplib.php
14 lib/setuplib.php
@@ -1193,7 +1193,12 @@ function make_upload_directory($directory, $exceptiononerror = true) {
1193 1193 */
1194 1194 function make_temp_directory($directory, $exceptiononerror = true) {
1195 1195 global $CFG;
1196   - protect_directory($CFG->tempdir);
  1196 + if ($CFG->tempdir !== "$CFG->dataroot/temp") {
  1197 + check_dir_exists($CFG->tempdir, true, true);
  1198 + protect_directory($CFG->tempdir);
  1199 + } else {
  1200 + protect_directory($CFG->dataroot);
  1201 + }
1197 1202 return make_writable_directory("$CFG->tempdir/$directory", $exceptiononerror);
1198 1203 }
1199 1204
@@ -1206,7 +1211,12 @@ function make_temp_directory($directory, $exceptiononerror = true) {
1206 1211 */
1207 1212 function make_cache_directory($directory, $exceptiononerror = true) {
1208 1213 global $CFG;
1209   - protect_directory($CFG->cachedir);
  1214 + if ($CFG->cachedir !== "$CFG->dataroot/cache") {
  1215 + check_dir_exists($CFG->cachedir, true, true);
  1216 + protect_directory($CFG->cachedir);
  1217 + } else {
  1218 + protect_directory($CFG->dataroot);
  1219 + }
1210 1220 return make_writable_directory("$CFG->cachedir/$directory", $exceptiononerror);
1211 1221 }
1212 1222

0 comments on commit e79c098

Please sign in to comment.
Something went wrong with that request. Please try again.