]> git.mjollnir.org Git - moodle.git/commitdiff
Merged fix of MDL-7361 from MOODLE-17-STABLE
authormudrd8mz <mudrd8mz>
Tue, 7 Nov 2006 13:35:12 +0000 (13:35 +0000)
committermudrd8mz <mudrd8mz>
Tue, 7 Nov 2006 13:35:12 +0000 (13:35 +0000)
admin/lang.php

index a4001c807883a120793fd88ce190ce5c768ed23c..73be689d8736a90fff7c492107c520f9a32d07c1 100644 (file)
@@ -4,6 +4,9 @@
     *
     * CHANGES
     *
+    * 2006/11/07 mudrd8mz
+    * Fixed bug MDL-7361. Thanks to Dan Poltawski for the patch proposal.
+    *
     * 2006/06/08 mudrd8mz
     * 1) Fixed bug 5745 reported by Harry Smith so now can edit en_utf8_local pack
     * 2) More notification messages included
 
     // Get a list of all the root files in the English directory
 
+    $langbase = $CFG->dataroot . '/lang';
     $enlangdir = "$CFG->dirroot/lang/en_utf8";
     if ($currentlang == 'en_utf8') {
         $langdir = $enlangdir;
     } else {
-        $langdir = "$CFG->dataroot/lang/$currentlang";
+        $langdir = "$langbase/$currentlang";
     }
-    $locallangdir = "$CFG->dataroot/lang/{$currentlang}_local";
+    $locallangdir = "$langbase/{$currentlang}_local";
 
     if (! $stringfiles = get_directory_list($enlangdir, "", false)) {
         error("Could not find English language pack!");
 
     } else if ($mode == "compare") {
    
+        if (!file_exists($langbase) ){
+            if (!lang_make_directory($langbase) ){
+                error('ERROR: Could not create base lang directory ' . $langbase);
+            } else {
+                echo '<div class="notifysuccess" align="center">Created directory '.
+                                                     $langbase .'</div>'."<br />\n";
+            }
+        } 
         if (!$uselocal && !file_exists($langdir)) {
             if (!lang_make_directory($langdir)) {
                 error('ERROR: Could not create directory '.$langdir);
@@ -573,7 +585,7 @@ function lang_fix_value_from_file($value='') {
  * Try and create a new language directory.
  *
  * @uses $CFG
- * @param string $directory  directory name under $CFG->dataroot/lang eg cs_utf8_local
+ * @param string $directory full path to the directory under $langbase
  * @return string|false Returns full path to directory if successful, false if not
  */
 function lang_make_directory($dir, $shownotices=true) {