Undoing my hacks to try and keep this code clean as possible.

This commit is contained in:
moodler 2006-10-04 15:30:54 +00:00
parent eb87ac71c5
commit a9b1f143d2

View file

@ -251,11 +251,6 @@ function table_exists($table) {
$exists = true; $exists = true;
/// Retrieve the table object in case just a name was supplied
if (is_string($table)) {
$table = new XMLDBTable($table);
}
/// Do this function silenty (to avoid output in install/upgrade process) /// Do this function silenty (to avoid output in install/upgrade process)
$olddbdebug = $db->debug; $olddbdebug = $db->debug;
$db->debug = false; $db->debug = false;
@ -295,16 +290,6 @@ function field_exists($table, $field) {
$exists = true; $exists = true;
/// Retrieve the table object in case just a name was supplied
if (is_string($table)) {
$table = new XMLDBTable($table);
}
/// Retrieve the field object in case just a name was supplied
if (is_string($field)) {
$field = new XMLDBField($field);
}
/// Do this function silenty (to avoid output in install/upgrade process) /// Do this function silenty (to avoid output in install/upgrade process)
$olddbdebug = $db->debug; $olddbdebug = $db->debug;
$db->debug = false; $db->debug = false;
@ -352,16 +337,6 @@ function index_exists($table, $index) {
$exists = true; $exists = true;
/// Retrieve the table object in case just a name was supplied
if (is_string($table)) {
$table = new XMLDBTable($table);
}
/// Retrieve the index object in case just a name was supplied
if (is_string($index)) {
$index = new XMLDBIndex($index);
}
/// Do this function silenty (to avoid output in install/upgrade process) /// Do this function silenty (to avoid output in install/upgrade process)
$olddbdebug = $db->debug; $olddbdebug = $db->debug;
$db->debug = false; $db->debug = false;
@ -580,11 +555,6 @@ function drop_table($table, $continue=true, $feedback=true) {
$status = true; $status = true;
/// Retrieve the table object in case just a name was supplied
if (is_string($table)) {
$table = new XMLDBTable($table);
}
if (strtolower(get_class($table)) != 'xmldbtable') { if (strtolower(get_class($table)) != 'xmldbtable') {
return false; return false;
} }
@ -619,11 +589,6 @@ function rename_table($table, $newname, $continue=true, $feedback=true) {
$status = true; $status = true;
/// Retrieve the table object in case just a name was supplied
if (is_string($table)) {
$table = new XMLDBTable($table);
}
if (strtolower(get_class($table)) != 'xmldbtable') { if (strtolower(get_class($table)) != 'xmldbtable') {
return false; return false;
} }
@ -663,11 +628,6 @@ function add_field($table, $field, $continue=true, $feedback=true) {
$status = true; $status = true;
/// Retrieve the table object in case just a name was supplied
if (is_string($table)) {
$table = new XMLDBTable($table);
}
if (strtolower(get_class($table)) != 'xmldbtable') { if (strtolower(get_class($table)) != 'xmldbtable') {
return false; return false;
} }
@ -704,11 +664,6 @@ function drop_field($table, $field, $continue=true, $feedback=true) {
$status = true; $status = true;
/// Retrieve the table object in case just a name was supplied
if (is_string($table)) {
$table = new XMLDBTable($table);
}
if (strtolower(get_class($table)) != 'xmldbtable') { if (strtolower(get_class($table)) != 'xmldbtable') {
return false; return false;
} }
@ -745,12 +700,6 @@ function change_field_type($table, $field, $continue=true, $feedback=true) {
$status = true; $status = true;
/// Retrieve the table object in case just a name was supplied
if (is_string($table)) {
$table = new XMLDBTable($table);
}
if (strtolower(get_class($table)) != 'xmldbtable') { if (strtolower(get_class($table)) != 'xmldbtable') {
return false; return false;
} }
@ -829,11 +778,6 @@ function change_field_enum($table, $field, $continue=true, $feedback=true) {
$status = true; $status = true;
/// Retrieve the table object in case just a name was supplied
if (is_string($table)) {
$table = new XMLDBTable($table);
}
if (strtolower(get_class($table)) != 'xmldbtable') { if (strtolower(get_class($table)) != 'xmldbtable') {
return false; return false;
} }
@ -864,11 +808,6 @@ function change_field_default($table, $field, $continue=true, $feedback=true) {
$status = true; $status = true;
/// Retrieve the table object in case just a name was supplied
if (is_string($table)) {
$table = new XMLDBTable($table);
}
if (strtolower(get_class($table)) != 'xmldbtable') { if (strtolower(get_class($table)) != 'xmldbtable') {
return false; return false;
} }
@ -899,17 +838,6 @@ function rename_field($table, $field, $newname, $continue=true, $feedback=true)
global $CFG, $db; global $CFG, $db;
/// Retrieve the table object in case just a name was supplied
if (is_string($table)) {
$table = new XMLDBTable($table);
}
/// Retrieve the field object in case just a name was supplied
if (is_string($field)) {
$field = new XMLDBField($field);
}
$status = true; $status = true;
if (strtolower(get_class($table)) != 'xmldbtable') { if (strtolower(get_class($table)) != 'xmldbtable') {
@ -960,11 +888,6 @@ function add_key($table, $key, $continue=true, $feedback=true) {
$status = true; $status = true;
/// Retrieve the table object in case just a name was supplied
if (is_string($table)) {
$table = new XMLDBTable($table);
}
if (strtolower(get_class($table)) != 'xmldbtable') { if (strtolower(get_class($table)) != 'xmldbtable') {
return false; return false;
} }
@ -999,11 +922,6 @@ function drop_key($table, $key, $continue=true, $feedback=true) {
$status = true; $status = true;
/// Retrieve the table object in case just a name was supplied
if (is_string($table)) {
$table = new XMLDBTable($table);
}
if (strtolower(get_class($table)) != 'xmldbtable') { if (strtolower(get_class($table)) != 'xmldbtable') {
return false; return false;
} }
@ -1042,11 +960,6 @@ function rename_key($table, $key, $newname, $continue=true, $feedback=true) {
$status = true; $status = true;
/// Retrieve the table object in case just a name was supplied
if (is_string($table)) {
$table = new XMLDBTable($table);
}
if (strtolower(get_class($table)) != 'xmldbtable') { if (strtolower(get_class($table)) != 'xmldbtable') {
return false; return false;
} }
@ -1085,11 +998,6 @@ function add_index($table, $index, $continue=true, $feedback=true) {
$status = true; $status = true;
/// Retrieve the table object in case just a name was supplied
if (is_string($table)) {
$table = new XMLDBTable($table);
}
if (strtolower(get_class($table)) != 'xmldbtable') { if (strtolower(get_class($table)) != 'xmldbtable') {
return false; return false;
} }
@ -1127,17 +1035,6 @@ function drop_index($table, $index, $continue=true, $feedback=true) {
$status = true; $status = true;
/// Retrieve the table object in case just a name was supplied
if (is_string($table)) {
$table = new XMLDBTable($table);
}
/// Retrieve the index object in case just a name was supplied
if (is_string($index)) {
$index = new XMLDBIndex($index);
}
if (strtolower(get_class($table)) != 'xmldbtable') { if (strtolower(get_class($table)) != 'xmldbtable') {
return false; return false;
} }
@ -1179,16 +1076,6 @@ function rename_index($table, $index, $newname, $continue=true, $feedback=true)
$status = true; $status = true;
/// Retrieve the table object in case just a name was supplied
if (is_string($table)) {
$table = new XMLDBTable($table);
}
/// Retrieve the index object in case just a name was supplied
if (is_string($index)) {
$index = new XMLDBIndex($index);
}
if (strtolower(get_class($table)) != 'xmldbtable') { if (strtolower(get_class($table)) != 'xmldbtable') {
return false; return false;
} }