]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19305 xmldb editor - throw message when there are changes pending to save and...
authorstronk7 <stronk7>
Thu, 28 May 2009 21:48:13 +0000 (21:48 +0000)
committerstronk7 <stronk7>
Thu, 28 May 2009 21:48:13 +0000 (21:48 +0000)
admin/xmldb/actions/main_view/main_view.class.php
lang/en_utf8/xmldb.php

index e7790ae7ee42a20853e4257a35c576ffd618dba8..bea4661a7296b59e7d05f74eca0a5a9349525dee 100644 (file)
@@ -58,7 +58,8 @@ class main_view extends XMLDBAction {
             'checkforeignkeys' => 'xmldb',
             'checkbigints' => 'xmldb',
             'doc' => 'xmldb',
-            'viewxml' => 'xmldb'
+            'viewxml' => 'xmldb',
+            'pendingchangescannotbesaved' => 'xmldb'
         ));
     }
 
@@ -265,9 +266,9 @@ class main_view extends XMLDBAction {
                     if ($structure =& $dbdir->xml_file->getStructure()) {
                         if ($errors = $structure->getAllErrors()) {
                             if ($hithis) {
-                                $o .= '<tr class="highlight"><td class="error cell" colspan="9">' . implode (', ', $errors) . '</td></tr>';
+                                $o .= '<tr class="highlight"><td class="error cell" colspan="10">' . implode (', ', $errors) . '</td></tr>';
                             } else {
-                                $o .= '<tr class="r' . $row . '"><td class="error cell" colspan="9">' . implode (', ', $errors) . '</td></tr>';
+                                $o .= '<tr class="r' . $row . '"><td class="error cell" colspan="10">' . implode (', ', $errors) . '</td></tr>';
                             }
                         }
                     }
@@ -282,9 +283,9 @@ class main_view extends XMLDBAction {
                                     foreach ($fields as $field) {
                                         if (!empty($field->hasenums)) {
                                             if ($hithis) {
-                                                $o .= '<tr class="highlight"><td class="error cell" colspan="9">';
+                                                $o .= '<tr class="highlight"><td class="error cell" colspan="10">';
                                             } else {
-                                                $o .= '<tr class="r' . $row . '"><td class="error cell" colspan="9">';
+                                                $o .= '<tr class="r' . $row . '"><td class="error cell" colspan="10">';
                                             }
                                             $o .= 'Table ' . $table->getName() . ', field ' . $field->getName() . ' has ENUM info';
                                             if (!empty($field->hasenumsenabled)) {
@@ -306,6 +307,21 @@ class main_view extends XMLDBAction {
                         }
                     }
                 }
+            /// If there are changes pending to be saved, but the file cannot be written... inform here
+                if ($dbdir->path_exists &&
+                    file_exists($key . '/install.xml') &&
+                    !empty($dbdir->xml_loaded) &&
+                    !empty($dbdir->xml_changed) &&
+                    (!is_writeable($key . '/install.xml') || !is_writeable($key))) {
+
+                    if ($hithis) {
+                        $o .= '<tr class="highlight"><td class="error cell" colspan="10">';
+                    } else {
+                        $o .= '<tr class="r' . $row . '"><td class="error cell" colspan="10">';
+                    }
+                    $o .= $this->str['pendingchangescannotbesaved'];
+                    $o .= '</td></tr>';
+                }
             }
             $o .= '</table>';
 
index 849634bf93ef72216b1cad21d9789388c3c4e939..4efc68f7e99762221532e5effda772d32aa89574 100644 (file)
@@ -116,6 +116,7 @@ $string['nowrongdefaultsfound'] = 'No inconsistent default values have been foun
 $string['nowrongintsfound'] = 'No wrong integers have been found, your DB doesn\'t need further actions.';
 $string['numberincorrectdecimals'] = 'Incorrect number of decimals for number field';
 $string['numberincorrectlength'] = 'Incorrect length for number field';
+$string['pendingchangescannotbesaved'] = 'There are changes in this file but they cannot be saved! Please verify that both the directory and the \"install.xml\" within it have write permissions for the web server. Then reload this page and you should be able to save those changes.';
 $string['reserved'] = 'Reserved';
 $string['reservedwords'] = 'Reserved words';
 $string['revert'] = 'Revert';