]> git.mjollnir.org Git - moodle.git/commitdiff
Improve save file, showing the proper error if not writeable.
authorstronk7 <stronk7>
Wed, 30 Aug 2006 17:12:00 +0000 (17:12 +0000)
committerstronk7 <stronk7>
Wed, 30 Aug 2006 17:12:00 +0000 (17:12 +0000)
admin/xmldb/actions/save_xml_file/save_xml_file.class.php

index aed9b92f4e8127ab9ab5d9e78a53e7fc69b5a50e..60f5810cf85adce78e9f1267cd4d6f799607f037 100644 (file)
@@ -38,7 +38,7 @@ class save_xml_file extends XMLDBAction {
 
     /// Get needed strings
         $this->loadStrings(array(
-        /// 'key' => 'module'
+            'filenotwriteable' => 'xmldb'
         ));
     }
 
@@ -78,6 +78,12 @@ class save_xml_file extends XMLDBAction {
             }
         }
 
+    /// Chech for perms
+        if (!is_writeable($dirpath . '/install.xml')) {
+            $this->errormsg = $this->str['filenotwriteable'] . '(' . $dirpath . '/install.xml)';
+            return false;
+        }
+
     /// Save the original dir
         $result = $dbdir->xml_file->saveXMLFile();
 
@@ -91,7 +97,8 @@ class save_xml_file extends XMLDBAction {
             unset($XMLDB->dbdirs[$dirpath]->xml_exists);
             unset($XMLDB->dbdirs[$dirpath]->xml_writeable);
         } else {
-            $errormsg = 'Error saving XML file (' . $dirpath . ')';
+            $this->errormsg = 'Error saving XML file (' . $dirpath . ')';
+            return false;
         }
 
     /// Launch postaction if exists (leave this here!)