From: stronk7 Date: Thu, 28 May 2009 21:48:13 +0000 (+0000) Subject: MDL-19305 xmldb editor - throw message when there are changes pending to save and... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=9dd35834eebae9c9d4bbc1ad0521197f8949eb28;p=moodle.git MDL-19305 xmldb editor - throw message when there are changes pending to save and perms don't allow it. --- diff --git a/admin/xmldb/actions/main_view/main_view.class.php b/admin/xmldb/actions/main_view/main_view.class.php index e7790ae7ee..bea4661a72 100644 --- a/admin/xmldb/actions/main_view/main_view.class.php +++ b/admin/xmldb/actions/main_view/main_view.class.php @@ -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 .= '' . implode (', ', $errors) . ''; + $o .= '' . implode (', ', $errors) . ''; } else { - $o .= '' . implode (', ', $errors) . ''; + $o .= '' . implode (', ', $errors) . ''; } } } @@ -282,9 +283,9 @@ class main_view extends XMLDBAction { foreach ($fields as $field) { if (!empty($field->hasenums)) { if ($hithis) { - $o .= ''; + $o .= ''; } else { - $o .= ''; + $o .= ''; } $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 .= ''; + } else { + $o .= ''; + } + $o .= $this->str['pendingchangescannotbesaved']; + $o .= ''; + } } $o .= ''; diff --git a/lang/en_utf8/xmldb.php b/lang/en_utf8/xmldb.php index 849634bf93..4efc68f7e9 100644 --- a/lang/en_utf8/xmldb.php +++ b/lang/en_utf8/xmldb.php @@ -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';