mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Now the editor detects if the xml file has been locally modified
since loading it. Second part of MDL-8264 Merged from MOODLE_18_STABLE
This commit is contained in:
parent
4883dcc56d
commit
5f6435d4c0
@ -95,6 +95,9 @@ class load_xml_file extends XMLDBAction {
|
||||
$loaded = $xmldb_file->loadXMLStructure();
|
||||
if ($loaded && $xmldb_file->isLoaded()) {
|
||||
$dbdir->xml_loaded = true;
|
||||
if (!empty($dbdir->filemtime)) {
|
||||
$dbdir->filemtime = filemtime($dbdir->path . '/install.xml');
|
||||
}
|
||||
}
|
||||
$dbdir->xml_file = $xmldb_file;
|
||||
} else {
|
||||
|
@ -157,6 +157,13 @@ class main_view extends XMLDBAction {
|
||||
!empty($dbdir->xml_loaded) &&
|
||||
!empty($dbdir->xml_changed)) {
|
||||
$b .= '<a href="index.php?action=save_xml_file&dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '&time=' . time() . '&postaction=main_view#lastused">[' . $this->str['save'] . ']</a>';
|
||||
/// Check if the file has been manually edited while being modified in the editor
|
||||
if ($dbdir->filemtime != filemtime($key . '/install.xml')) {
|
||||
/// File manually modified. Add to errors.
|
||||
if ($structure =& $dbdir->xml_file->getStructure()) {
|
||||
$structure->errormsg = 'Warning: File locally modified while using the XMLDB Editor. Saving will overwrite local changes';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$b .= '[' . $this->str['save'] . ']';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user