uninstall.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * This script is included by main/admin/settings.lib.php when unselecting a plugin
  4. * and is meant to remove things installed by the install.php script in both
  5. * the global database and the courses tables
  6. * @package chamilo.plugin.bigbluebutton
  7. */
  8. /**
  9. * Queries
  10. */
  11. require 'config.php';
  12. $t_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
  13. $t_options = Database::get_main_table(TABLE_MAIN_SETTINGS_OPTIONS);
  14. $sql = "DELETE FROM $t_settings WHERE variable = 'bbb_plugin'";
  15. Database::query($sql);
  16. $sql = "DELETE FROM $t_options WHERE variable = 'bbb_plugin'";
  17. Database::query($sql);
  18. $sql = "DELETE FROM $t_settings WHERE variable = 'bbb_plugin_host'";
  19. Database::query($sql);
  20. $sql = "DELETE FROM $t_settings WHERE variable = 'bbb_plugin_salt'";
  21. Database::query($sql);
  22. $sql = "DROP TABLE IF EXISTS plugin_bbb_meeting";
  23. Database::query($sql);
  24. // update existing courses to add conference settings
  25. $t_courses = Database::get_main_table(TABLE_MAIN_COURSE);
  26. $sql = "SELECT id, code FROM $t_courses ORDER BY id";
  27. $res = Database::query($sql);
  28. while ($row = Database::fetch_assoc($res)) {
  29. $t_course = Database::get_course_table(TABLE_COURSE_SETTING);
  30. // $variables is loaded in the config.php file
  31. foreach ($variables as $variable) {
  32. $sql_course = "DELETE FROM $t_course WHERE c_id = " . $row['id'] . " AND variable = '$variable'";
  33. $r = Database::query($sql_course);
  34. }
  35. $t_tool = Database::get_course_table(TABLE_TOOL_LIST);
  36. $sql_course = "DELETE FROM $t_tool WHERE c_id = " . $row['id'] . " AND link = '../../plugin/bbb/start.php'";
  37. $r = Database::query($sql_course);
  38. }