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

lang dir not able to be created in moodle data folder

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.7
    • Fix Version/s: 1.7.1
    • Component/s: Language
    • Labels:
      None
    • Environment:
      WIndows XP SP2, Apache/MySQL
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_17_STABLE
    • Fixed Branches:
      MOODLE_17_STABLE

      Description

      A new install of 1.7 beta 2.
      Moodle data folder is in Shared Documents on windows and this works for course creation.
      When trying to edit strings an error says the language pack folder cannot be created.

      Work around is to manually create a lang folder first.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            poltawski Dan Poltawski added a comment -

            You can reproduce this bug if you just delete the dataroot/lang directory, i've come across it myself in different scenarios. This shoudl fix it: (btw how does one do localised error messages on the lang creation stuff!)

            — ../../moodle/admin/lang.php 2006-11-05 14:08:10.000000000 +0000
            +++ lang.php 2006-11-06 09:36:11.000000000 +0000
            @@ -255,6 +255,14 @@
            }

            } else if ($mode == "compare") {
            +
            + $locallangbase = $CFG->dataroot . '/lang';
            +
            + if(! file_exists($locallangbase) ){
            + if(! lang_make_directory($locallangbase) )

            { + error('Error: Could not create base lang directory ' . $locallangbase); + }

            + }

            if (!$uselocal && !file_exists($langdir)) {
            if (!lang_make_directory($langdir)) {

            Show
            poltawski Dan Poltawski added a comment - You can reproduce this bug if you just delete the dataroot/lang directory, i've come across it myself in different scenarios. This shoudl fix it: (btw how does one do localised error messages on the lang creation stuff!) — ../../moodle/admin/lang.php 2006-11-05 14:08:10.000000000 +0000 +++ lang.php 2006-11-06 09:36:11.000000000 +0000 @@ -255,6 +255,14 @@ } } else if ($mode == "compare") { + + $locallangbase = $CFG->dataroot . '/lang'; + + if(! file_exists($locallangbase) ){ + if(! lang_make_directory($locallangbase) ) { + error('Error: Could not create base lang directory ' . $locallangbase); + } + } if (!$uselocal && !file_exists($langdir)) { if (!lang_make_directory($langdir)) {
            Hide
            poltawski Dan Poltawski added a comment -

            I was a bit hasty with that patch, think this one attached would be better.

            Show
            poltawski Dan Poltawski added a comment - I was a bit hasty with that patch, think this one attached would be better.
            Hide
            koen Koen Roggemans added a comment -

            Think this is one for you David

            Show
            koen Koen Roggemans added a comment - Think this is one for you David
            Hide
            mudrd8mz David Mudrák added a comment -

            Thanks for the report, assignment, and the patch

            It would be fine if lang.php used make_upload_directory() as e.g. install.php does instead of its own lang_make_directory(). But the problem is this would require quite a big rewrite because make_upload_directory() accepts dirname relative to the $CFG->dataroot while lang_make_directory() and the rest of pang.php works with full paths.
            That is why I have fixed this according to Dan's patch (imho the first one submitted is better than the later one attached).
            I am receiving errors from CVS so see my patch attached. I will commit it as soon as my rights are OK again.

            Show
            mudrd8mz David Mudrák added a comment - Thanks for the report, assignment, and the patch It would be fine if lang.php used make_upload_directory() as e.g. install.php does instead of its own lang_make_directory(). But the problem is this would require quite a big rewrite because make_upload_directory() accepts dirname relative to the $CFG->dataroot while lang_make_directory() and the rest of pang.php works with full paths. That is why I have fixed this according to Dan's patch (imho the first one submitted is better than the later one attached). I am receiving errors from CVS so see my patch attached. I will commit it as soon as my rights are OK again.
            Hide
            mudrd8mz David Mudrák added a comment -

            David's patch based on Dan Poltawski's one.

            Show
            mudrd8mz David Mudrák added a comment - David's patch based on Dan Poltawski's one.
            Hide
            mudrd8mz David Mudrák added a comment -

            The patched version works for me. Please test and confirm.

            Show
            mudrd8mz David Mudrák added a comment - The patched version works for me. Please test and confirm.
            Hide
            mudrd8mz David Mudrák added a comment -

            The patch was commited into both STABLE and HEAD branches.

            Show
            mudrd8mz David Mudrák added a comment - The patch was commited into both STABLE and HEAD branches.

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  17/Jan/07