Skip to content

Commit

Permalink
MDL-19058 xmldb editor & enums - inform about ENUM info detected in all
Browse files Browse the repository at this point in the history
the loaded files, suggesting different options depending of active/inactive ENUMs found
  • Loading branch information
stronk7 committed May 26, 2009
1 parent 16454b0 commit 3a0a3d7
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions admin/xmldb/actions/main_view/main_view.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,43 @@ function invoke() {
if ($structure =& $dbdir->xml_file->getStructure()) {
if ($errors = $structure->getAllErrors()) {
if ($hithis) {
$o .= '<tr class="highlight"><td class="error cell" colspan="8">' . implode (', ', $errors) . '</td></tr>';
$o .= '<tr class="highlight"><td class="error cell" colspan="9">' . implode (', ', $errors) . '</td></tr>';
} else {
$o .= '<tr class="r' . $row . '"><td class="error cell" colspan="8">' . implode (', ', $errors) . '</td></tr>';
$o .= '<tr class="r' . $row . '"><td class="error cell" colspan="9">' . implode (', ', $errors) . '</td></tr>';
}
}
}
}
/// TODO: Drop this check in Moodle 2.1
/// Intercept loaded structure here and look for ENUM fields
if (isset($dbdir->xml_file)) {
if ($structure =& $dbdir->xml_file->getStructure()) {
if ($tables = $structure->getTables()) {
foreach ($tables as $table) {
if ($fields = $table->getFields()) {
foreach ($fields as $field) {
if (!empty($field->hasenums)) {
if ($hithis) {
$o .= '<tr class="highlight"><td class="error cell" colspan="9">';
} else {
$o .= '<tr class="r' . $row . '"><td class="error cell" colspan="9">';
}
$o .= 'Table ' . $table->getName() . ', field ' . $field->getName() . ' has ENUM info';
if (!empty($field->hasenumsenabled)) {
$o .= ' that seems to be active (true). ENUMs support has been dropped in Moodle 2.0, ' .
' the XMLDB Editor will delete any ENUM reference next time you save this file' .
' and you MUST provide one upgrade block in your code to drop them from DB. See' .
' <a href="http://docs.moodle.org/en/Development:DB_layer_2.0_migration_docs#The_changes">' .
' Moodle Docs</a> for more info and examples.';
} else {
$o .= ' that seem to be inactive (false). ENUMs support has been dropped in Moodle 2.0,' .
' the XMLDB Editor will, simply, delete any ENUM reference next time you save this file.' .
' No further action is necessary.';
}
$o .= '</td></tr>';
}
}
}
}
}
}
Expand Down

0 comments on commit 3a0a3d7

Please sign in to comment.