Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-14827

bug with check_dir_exists in moodlelib.php when using $recursive on windows systems.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • None
    • 1.9
    • Libraries
    • None
    • MOODLE_19_STABLE

      when $recursive is used on a windows machine, the "windows compatibility" hack in check_dir_exists fails.

      eg when:
      $CFG->dataroot = "c:\mysite\moodledata"
      make this dir = "c:\mysite\moodledata\test\1"

      this call:
      $dir = str_replace('
      ', '/', $dir); //windows compatibility

      makes $dir contain the "make this dir" but with \ turned into /

      then this call:
      $dir = str_replace($CFG->dataroot . '/', '', $dir);

      fails under windows. - as $dir doesn't match what is contained in $CFG->dataroot - eg it looks like this:
      $dir = str_replace(c:\mysite\moodledata/, '', c:/mysite/moodledata/test/1)

      it should be replaced to something like this:
      $dir = str_replace(str_replace('
      ', '/', $CFG->dataroot) . '/', '', $dir);

      (thanks to Colin from OU for help finding the bug!)

      Dan

            danmarsden Dan Marsden
            danmarsden Dan Marsden
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.