/// return to original debugging level
$CFG->debug = $origdebug;
error_reporting($CFG->debug);
- $DB->set_debug(true);
if (!$DB->setup_is_unicodedb()) {
if (!$DB->change_db_encoding()) {
}
}
+ upgrade_log_start(true); // does not store ugprade runnign flag
+ print_heading('coresystem');
$DB->get_manager()->install_from_xmldb_file("$CFG->libdir/db/install.xml");
- upgrade_log_start(); // move here because we want the flag to be stored in config table ;-)
+ upgrade_log_start(); // we want the flag to be stored in config table ;-)
/// set all core default records and default settings
require_once("$CFG->libdir/db/install.php");
// Write default settings unconditionally (i.e. even if a setting is already set, overwrite it)
admin_apply_default_settings(NULL, true);
notify($strdatabasesuccess, 'notifysuccess');
-
- /// do not show certificates in log ;-)
- $DB->set_debug(false);
+ print_upgrade_separator();
}
} else {
- $strdatabasesuccess = get_string("databasesuccess");
upgrade_log_start();
/// return to original debugging level
}
print_heading($strdatabasechecking);
- $DB->set_debug(true);
/// Launch the old main upgrade (if exists)
$status = xmldb_main_upgrade($CFG->version);
- $DB->set_debug(false);
/// If successful, continue upgrading roles and setting everything properly
if ($status) {
- if (!update_capabilities()) {
- print_error('cannotupgradecapabilities', 'debug');
- }
+ update_capabilities();
// Update core events
events_update_definition();
set_config("version", $version);
remove_dir($CFG->dataroot . '/cache', true); // flush cache
- notify($strdatabasesuccess, "green");
+ notify(get_string("databasesuccess"), "green");
+ print_upgrade_separator();
/// Main upgrade not success
} else {
// Write default settings unconditionally (i.e. even if a setting is already set, overwrite it)
admin_apply_default_settings(NULL, true);
- /// do not show certificates in log ;-)
- $DB->set_debug(false);
-
/// upgrade all plugins types
$upgradedplugins = false;
// NOTE: course, category, session, user themes still require the
// respective settings to be enabled
//
-// When working with production data on test servers, no emails should ever be send to real users
-// $CFG->noemailever = true;
-//
//=========================================================================
// 8. SETTINGS FOR DEVELOPMENT SERVERS - not intended for production use!!!
//=========================================================================
//
+// When working with production data on test servers, no emails should ever be send to real users
+// $CFG->noemailever = true;
+//
// Specify prefix for fake unit test tables. If not specified only tests
-// taht do not need fake tables will be executed.
+// that do not need fake tables will be executed.
// $CFG->unittestprefix = 'tst_';
//
// special magic evil developer only wanting to edit the xmldb files manually
// $CFG->xmldbdisablecommentchecking = true;
// $CFG->xmldbdisablenextprevchecking = true;
//
-// special magig evil developer only wanting to edit xmldb files manually
+// Special magic - evil developer only wanting to edit xmldb files manually
// AND allowing the XMLDBEditor to recostruct the prev/next elements every
// time one file is loaded and saved (Moodle).
// Uncomment this if you're lazy like Petr
// $CFG->xmldbreconstructprevnext = true;
//
+//
+// Since 2.0 sql queries are not shown during upgrade by default.
+// Please note that this setting may produce very long upgrade page on large sites.
+// $CFG->upgradeshowsql = true;
+
+
//=========================================================================
// ALL DONE! To continue installation, visit your main page with a browser
function load_all_capabilities() {
global $USER, $CFG, $DIRTYCONTEXTS;
+ if (empty($CFG->rolesactive)) {
+ return;
+ }
+
$base = '/'.SYSCONTEXTID;
if (isguestuser()) {
// is the default role interesting? does it have
// a relevant rolecap? (we use this a lot later)
- if (in_array((int)$CFG->defaultuserroleid, $roleids, true)) {
+ if (isset($CFG->defaultuserroleid) and in_array((int)$CFG->defaultuserroleid, $roleids, true)) {
$defaultroleinteresting = true;
} else {
$defaultroleinteresting = false;
*/
function mark_context_dirty($path) {
global $CFG, $DIRTYCONTEXTS;
+
+ if (empty($CFG->rolesactive)) {
+ return;
+ }
+
// only if it is a non-empty string
if (is_string($path) && $path !== '') {
set_cache_flag('accesslib/dirtycontexts', $path, 1, time()+$CFG->sessiontimeout);
$updated_plugins = true;
upgrade_log_start();
print_heading($dir.'/'. $plugin->name .' plugin needs upgrading');
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
- $DB->set_debug(true);
- }
@set_time_limit(0); // To allow slow databases to complete the long SQL
if ($installedversion == 0) { // It's a new install of this plugin
$DB->get_manager()->install_from_xmldb_file($fullplug . '/db/install.xml'); //New method
}
$status = true;
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
- $DB->set_debug(false);
- }
/// Continue with the instalation, roles and other stuff
if ($status) {
/// OK so far, now update the plugins record
$newupgrade_function = 'xmldb_' .$plugin->fullname .'_upgrade';
$newupgrade_status = true;
if ($newupgrade && function_exists($newupgrade_function)) {
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
- $DB->set_debug(true);
- }
$newupgrade_status = $newupgrade_function($installedversion);
} else if ($newupgrade) {
notify ('Upgrade function ' . $newupgrade_function . ' was not available in ' .
$fullplug . '/db/upgrade.php');
}
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
- $DB->set_debug(false);
- }
/// Now analyze upgrade results
if ($newupgrade_status) { // No upgrading failed
/// OK so far, now update the plugins record
notify('Upgrading '. $plugin->name .' from '. $installedversion .' to '. $plugin->version .' FAILED!');
}
}
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
- echo '<hr />';
- }
+ print_upgrade_separator();
} else {
print_error('cannotdowngrade', 'debug', '', (object)array('oldversion'=>$installedversion, 'newversion'=>$plugin->version));
}
/// Then, the new function if exists and the old one was ok
$newupgrade_status = true;
if ($newupgrade && function_exists($newupgrade_function)) {
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
- $DB->set_debug(true);
- }
$newupgrade_status = $newupgrade_function($currmodule->version, $module);
} else if ($newupgrade) {
notify ('Upgrade function ' . $newupgrade_function . ' was not available in ' .
$mod . ': ' . $fullmod . '/db/upgrade.php');
}
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
- $DB->set_debug(false);
- }
/// Now analyze upgrade results
if ($newupgrade_status) { // No upgrading failed
// OK so far, now update the modules record
$DB->update_record('modules', $module);
remove_dir($CFG->dataroot . '/cache', true); // flush cache
notify(get_string('modulesuccess', '', $module->name), 'notifysuccess');
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE) {
- echo '<hr />';
- }
+ print_upgrade_separator();
} else {
notify('Upgrading '. $module->name .' from '. $currmodule->version .' to '. $module->version .' FAILED!');
}
print_heading($module->name);
$updated_modules = true;
// To avoid unnecessary output from the SQL queries in the CLI version
- if (!defined('CLI_UPGRADE')|| !CLI_UPGRADE ) {
- $DB->set_debug(true);
- }
@set_time_limit(0); // To allow slow databases to complete the long SQL
/// Both old .sql files and new install.xml are supported
$DB->get_manager()->install_from_xmldb_file($fullmod . '/db/install.xml'); //New method
$status = true;
}
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
- $DB->set_debug(false);
- }
/// Continue with the installation, roles and other stuff
if ($status) {
}
notify(get_string('modulesuccess', '', $module->name), 'notifysuccess');
- if (!defined('CLI_UPGRADE')|| !CLI_UPGRADE ) {
- echo '<hr />';
- }
+ print_upgrade_separator();
} else {
print_error('cannotaddmodule', '', '', $module->name);
}
* Marks start of upgrade, blocks any other access to site.
* The upgrade is finished at the end of script or after timeout.
*/
-function upgrade_log_start() {
+function upgrade_log_start($preinstall=false) {
global $CFG, $DB;
static $started = false;
- if ($started) {
+ if ($preinstall) {
+ ignore_user_abort(true);
+ upgrade_setup_debug(true);
+
+ } else if ($started) {
upgrade_set_timeout(120);
} else {
build_navigation(array(array('name' => $strupgrade, 'link' => null, 'type' => 'misc'))), '',
upgrade_get_javascript(), false, ' ', ' ');
}
+ //$DB->set_debug(true); // should be configurable soon
ignore_user_abort(true);
register_shutdown_function('upgrade_finished_handler');
+ upgrade_setup_debug(true);
set_config('upgraderunning', time()+300);
$started = true;
}
* This function may be called repeatedly.
*/
function upgrade_log_finish($continueurl=null) {
- global $CFG;
+ global $CFG, $DB;
+
if (!empty($CFG->upgraderunning)) {
unset_config('upgraderunning');
+ upgrade_setup_debug(false);
ignore_user_abort(false);
if ($continueurl) {
print_continue($continueurl);
}
}
+function upgrade_setup_debug($starting) {
+ global $CFG, $DB;
+
+ static $originaldebug = null;
+
+ if ($starting) {
+ if ($originaldebug === null) {
+ $originaldebug = $DB->get_debug();
+ }
+ if (!empty($CFG->upgradeshowsql)) {
+ $DB->set_debug(true);
+ }
+ } else {
+ $DB->set_debug($originaldebug);
+ }
+}
+
+function print_upgrade_separator() {
+ if (!CLI_SCRIPT) {
+ echo '<hr />';
+ }
+}
+
/**
* Test if and critical warnings are present
* @return bool
/// Then, the new function if exists and the old one was ok
$newupgrade_status = true;
if ($newupgrade && function_exists($newupgrade_function)) {
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
- $DB->set_debug(true);
- }
$newupgrade_status = $newupgrade_function($currblock->version, $block);
} else if ($newupgrade) {
notify ('Upgrade function ' . $newupgrade_function . ' was not available in ' .
$fullblock . '/db/upgrade.php');
}
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
- $DB->set_debug(false);
- }
/// Now analyze upgrade results
if ($newupgrade_status) { // No upgrading failed
} else {
notify('Upgrading block '. $block->name .' from '. $currblock->version .' to '. $block->version .' FAILED!');
}
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
- echo '<hr />';
- }
+ print_upgrade_separator();
} else {
print_error('cannotdowngrade', 'debug', '', (object)array('oldversion'=>$currblock->version, 'newversion'=>$block->version));
}
$updated_blocks = true;
upgrade_log_start();
print_heading($block->name);
- if (!defined('CLI_UPGRADE')||!CLI_UPGRADE) {
- $DB->set_debug(true);
- }
@set_time_limit(0); // To allow slow databases to complete the long SQL
/// Both old .sql files and new install.xml are supported
if (file_exists($fullblock . '/db/install.xml')) {
$DB->get_manager()->install_from_xmldb_file($fullblock . '/db/install.xml'); //New method
}
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
- $DB->set_debug(false);
- }
$block->id = $DB->insert_record('block', $block);
$blockobj->after_install();
$component = 'block/'.$block->name;
message_update_providers($component);
notify(get_string('blocksuccess', '', $blocktitle), 'notifysuccess');
- if (!defined('CLI_UPGRADE')|| !CLI_UPGRADE) {
- echo '<hr />';
- }
+ print_upgrade_separator();
}
$blocktitles[$block->name] = $blocktitle;
$cat = get_course_category();
- $defaults = array('auth' => 'email',
+ $defaults = array('rolesactive' => '0', // marks fully set up system
+ 'auth' => 'email',
'auth_pop3mailbox' => 'INBOX',
'enrol' => 'manual',
'enrol_plugins_enabled' => 'manual',
FROM {course_categories} c, {course_categories} pc
WHERE c.parent=pc.id AND c.depth=0 AND pc.depth=?";
if ($rs = $DB->get_recordset_sql($sql, array($parentdepth))) {
- $DB->set_debug(false);
foreach ($rs as $cat) {
$cat->depth = $parentdepth+1;
$cat->path = $cat->path.'/'.$cat->id;
$DB->update_record('course_categories', $cat);
}
$rs->close();
- $DB->set_debug(false);
}
$parentdepth++;
if ($parentdepth > 100) {
$pbar = new progress_bar('migratecoursefiles', 500, true);
$rs = $DB->get_recordset('course');
- $olddebug = $DB->get_debug();
- $DB->set_debug(false); // lower debug level, there might be many files
$i = 0;
foreach ($rs as $course) {
$i++;
upgrade_migrate_files_course($context, '/', true);
$pbar->update($i, $count, "Migrated course files - course $i/$count.");
}
- $DB->set_debug($olddebug); // reset debug level
$rs->close();
return true;
$pbar = new progress_bar('migrateblogfiles', 500, true);
- $olddebug = $DB->get_debug();
- $DB->set_debug(false); // lower debug level, there might be many files
$i = 0;
foreach ($rs as $entry) {
$i++;
$DB->update_record('post', $entry);
$pbar->update($i, $count, "Migrated blog attachments - $i/$count.");
}
- $DB->set_debug($olddebug); // reset debug level
$rs->close();
}
throw new ddl_table_missing_exception($tablename);
}
- /// Do this function silenty (to avoid output in install/upgrade process)
- $olddbdebug = $this->mdb->get_debug();
- $this->mdb->set_debug(false);
-
if (is_string($field)) {
$fieldname = $field;
} else {
$exists = array_key_exists($fieldname, $columns);
- /// Re-set original debug
- $this->mdb->set_debug($olddbdebug);
-
return $exists;
}
throw new ddl_table_missing_exception($tablename);
}
- /// Do this function silenty (to avoid output in install/upgrade process)
- $olddbdebug = $this->mdb->get_debug();
- $this->mdb->set_debug(false);
-
/// Extract index columns
$indcolumns = $xmldb_index->getFields();
$diferences = array_merge(array_diff($columns, $indcolumns), array_diff($indcolumns, $columns));
/// If no diferences, we have find the index
if (empty($diferences)) {
- $this->mdb->set_debug($olddbdebug);
return $indexname;
}
}
/// Arriving here, index not found
- $this->mdb->set_debug($olddbdebug);
return false;
}
throw new ddl_field_missing_exception($xmldb_field->getName(), $xmldb_table->getName());
}
- /// Do this function silenty (to avoid output in install/upgrade process)
- $olddbdebug = $this->mdb->get_debug();
- $this->mdb->set_debug(false);
-
/// Get list of check_constraints in table/field
$checks = false;
if ($objchecks = $this->generator->getCheckConstraintsFromDB($xmldb_table, $xmldb_field)) {
}
/// Arriving here, check not found
- $this->mdb->set_debug($olddbdebug);
return $checks;
}
$sequencename = false;
- /// Do this function silenty (to avoid output in install/upgrade process)
- $olddbdebug = $this->mdb->get_debug();
- $this->mdb->set_debug(false);
-
$sequencename = $this->generator->getSequenceFromDB($xmldb_table);
- $this->mdb->set_debug($olddbdebug);
return $sequencename;
}
*/
public function install_from_xmldb_structure($xmldb_structure) {
- /// Do this function silenty (to avoid output in install/upgrade process)
- $olddbdebug = $this->mdb->get_debug();
- $this->mdb->set_debug(false);
-
if (!$sqlarr = $this->generator->getCreateStructureSQL($xmldb_structure)) {
return; // nothing to do
}
-
- $this->mdb->set_debug($olddbdebug);
-
$this->execute_sql_arr($sqlarr);
}
* @return boolean true/false
*/
public function table_exists($table, $temptable=false) {
- /// Do this function silenty (to avoid output in install/upgrade process)
- $olddbdebug = $this->mdb->get_debug();
- $this->mdb->set_debug(false);
-
if (is_string($table)) {
$tablename = $table;
} else {
$tables = $this->mdb->get_tables();
$exists = in_array($tablename, $tables);
- /// Re-set original debug
- $this->mdb->set_debug($olddbdebug);
-
return $exists;
}
upgrade_log_start();
require_once ($CFG->dirroot .'/local/db/upgrade.php');
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
- $DB->set_debug(true);
- }
xmldb_local_upgrade($CFG->local_version);
- if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
- $DB->set_debug(false);
- }
set_config('local_version', $local_version);
notify(get_string('databasesuccess'), 'notifysuccess');
notify(get_string('databaseupgradelocal', '', $local_version), 'notifysuccess');
+ print_upgrade_separator();
return true;
$pbar = new progress_bar('migrateassignmentfiles', 500, true);
- $olddebug = $DB->get_debug();
- $DB->set_debug(false); // lower debug level, there might be many files
$i = 0;
foreach ($rs as $submission) {
$i++;
@rmdir("$CFG->dataroot/$submission->course/$CFG->moddata/assignment/$submission->assignment");
@rmdir("$CFG->dataroot/$submission->course/$CFG->moddata/assignment");
}
- $DB->set_debug($olddebug); // reset debug level
$rs->close();
}
WHERE m.name='assignment' AND m.id=cm.module AND cm.instance=a.id";
if ($rs = $DB->get_recordset_sql($sql)) {
// too much debug output
- $prevdebug = $DB->get_debug();
- $DB->set_debug(false);
$pbar = new progress_bar('assignmentupgradegrades', 500, true);
$i=0;
foreach ($rs as $assignment) {
assignment_update_grades($assignment);
$pbar->update($i, $count, "Updating Assignment grades ($i/$count).");
}
- $DB->set_debug($prevdebug);
$rs->close();
upgrade_set_timeout(); // reset to default timeout
}
$pbar = new progress_bar('migratedatafiles', 500, true);
- $olddebug = $DB->get_debug();
- $DB->set_debug(false); // lower debug level, there might be very many files
$i = 0;
foreach ($rs as $content) {
$i++;
@rmdir("$CFG->dataroot/$content->course/$CFG->moddata/data");
@rmdir("$CFG->dataroot/$content->course/$CFG->moddata");
}
- $DB->set_debug($olddebug); // reset debug level
$rs->close();
}
upgrade_mod_savepoint($result, 2008091400, 'data');
WHERE m.name='data' AND m.id=cm.module AND cm.instance=d.id";
if ($rs = $DB->get_recordset_sql($sql)) {
// too much debug output
- $prevdebug = $DB->get_debug();
- $DB->set_debug(false);
$pbar = new progress_bar('dataupgradegrades', 500, true);
$i=0;
foreach ($rs as $data) {
data_update_grades($data, 0, false);
$pbar->update($i, $count, "Updating Database grades ($i/$count).");
}
- $DB->set_debug($prevdebug);
$rs->close();
}
}
WHERE ra.id IS NULL";
if ($rs = $DB->get_recordset_sql($sql, $params)) {
- $DB->set_debug(false);
foreach ($rs as $remove) {
$DB->delete_records('forum_subscriptions', array('userid'=>$remove->userid, 'forum'=>$remove->forumid));
echo '.';
}
- $DB->set_debug(true);
$rs->close();
}
$pbar = new progress_bar('migrateforumfiles', 500, true);
- $olddebug = $DB->get_debug();
- $DB->set_debug(false); // lower debug level, there might be very many files
$i = 0;
foreach ($rs as $post) {
$i++;
@rmdir("$CFG->dataroot/$post->course/$CFG->moddata/forum/$post->forum");
@rmdir("$CFG->dataroot/$post->course/$CFG->moddata/forum");
}
- $DB->set_debug($olddebug); // reset debug level
$rs->close();
}
FROM {forum} f, {course_modules} cm, {modules} m
WHERE m.name='forum' AND m.id=cm.module AND cm.instance=f.id";
if ($rs = $DB->get_recordset_sql($sql)) {
- // too much debug output
- $prevdebug = $DB->get_debug();
- $DB->set_debug(false);
$pbar = new progress_bar('forumupgradegrades', 500, true);
$i=0;
foreach ($rs as $forum) {
forum_update_grades($forum, 0, false);
$pbar->update($i, $count, "Updating Forum grades ($i/$count).");
}
- $DB->set_debug($prevdebug);
$rs->close();
}
}
$pbar = new progress_bar('migrateglossaryfiles', 500, true);
- $olddebug = $DB->get_debug();
- $DB->set_debug(false); // lower debug level, there might be very many files
$i = 0;
foreach ($rs as $entry) {
$i++;
@rmdir("$CFG->dataroot/$entry->course/$CFG->moddata/glossary/$entry->glossaryid");
@rmdir("$CFG->dataroot/$entry->course/$CFG->moddata/glossary");
}
- $DB->set_debug($olddebug); // reset debug level
$rs->close();
}
FROM {glossary} g, {course_modules} cm, {modules} m
WHERE m.name='glossary' AND m.id=cm.module AND cm.instance=g.id";
if ($rs = $DB->get_recordset_sql($sql)) {
- $prevdebug = $DB->get_debug();
- $DB->set_debug(false);
$pbar = new progress_bar('glossaryupgradegrades', 500, true);
$i=0;
foreach ($rs as $glossary) {
glossary_update_grades($glossary, 0, false);
$pbar->update($i, $count, "Updating Glossary grades ($i/$count).");
}
- $DB->set_debug($prevdebug);
$rs->close();
}
}
WHERE m.name='hotpot' AND m.id=cm.module AND cm.instance=h.id";
if ($rs = $DB->get_recordset_sql($sql)) {
// too much debug output
- $prevdebug = $DB->get_debug();
- $DB->set_debug(false);
$pbar = new progress_bar('hotpotupgradegrades', 500, true);
$i=0;
foreach ($rs as $hotpot) {
hotpot_update_grades($hotpot, 0, false);
$pbar->update($i, $count, "Updating Hotpot grades ($i/$count).");
}
- $DB->set_debug($prevdebug);
$rs->close();
}
}
FROM {lesson} l, {course_modules} cm, {modules} m
WHERE m.name='lesson' AND m.id=cm.module AND cm.instance=l.id";
if ($rs = $DB->get_recordset_sql($sql)) {
- $prevdebug = $DB->get_debug();
- $DB->set_debug(false);
$pbar = new progress_bar('lessonupgradegrades', 500, true);
$i=0;
foreach ($rs as $lesson) {
lesson_update_grades($lesson, 0, false);
$pbar->update($i, $count, "Updating Lesson grades ($i/$count).");
}
- $DB->set_debug($prevdebug);
$rs->close();
}
}
FROM {quiz} a, {course_modules} cm, {modules} m
WHERE m.name='quiz' AND m.id=cm.module AND cm.instance=a.id";
if ($rs = $DB->get_recordset_sql($sql)) {
- $prevdebug = $DB->get_debug();
- $DB->set_debug(false);
$pbar = new progress_bar('quizupgradegrades', 500, true);
$i=0;
foreach ($rs as $quiz) {
quiz_update_grades($quiz, 0, false);
$pbar->update($i, $count, "Updating Quiz grades ($i/$count).");
}
- $DB->set_debug($prevdebug);
$rs->close();
}
}
$pbar = new progress_bar('migratescormfiles', 500, true);
- $olddebug = $DB->get_debug();
- $DB->set_debug(false); // lower debug level, there might be many files
$i = 0;
foreach ($rs as $scorm) {
$i++;
@rmdir("$CFG->dataroot/$scorm->course/$CFG->moddata/scorm/");
@rmdir("$CFG->dataroot/$scorm->course/$CFG->moddata/");
}
- $DB->set_debug($olddebug); // reset debug level
$rs->close();
}
FROM {scorm} s, {course_modules} cm, {modules} m
WHERE m.name='scorm' AND m.id=cm.module AND cm.instance=s.id";
if ($rs = $DB->get_recordset_sql($sql)) {
- $prevdebug = $DB->get_debug();
- $DB->set_debug(false);
$pbar = new progress_bar('scormupgradegrades', 500, true);
$i=0;
foreach ($rs as $scorm) {
scorm_update_grades($scorm, 0, false);
$pbar->update($i, $count, "Updating Scorm grades ($i/$count).");
}
- $DB->set_debug($prevdebug);
$rs->close();
}
}