3 * module_uninstall.php performs reversion of module_install.php
7 * the line below safe-guards this file from being accessed directly from
8 * a web browser. It will only execute if required from within an ATutor script,
9 * in our case the Module::uninstall() method.
11 if (!defined('AT_INCLUDE_PATH')) { exit; }
14 * the following code is used for removing a module-specific directory created in module_install.php.
15 * it generates appropriate error messages to aid in its creation.
17 $directory = AT_CONTENT_DIR .'basiclti';
19 // check if the directory exists
20 if (is_dir($directory)) {
21 require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
23 if (!clr_dir($directory))
24 $msg->addError(array('MODULE_UNINSTALL', '<li>'.$directory.' can not be removed. Please manually remove it.</li>'));
28 * the following code checks if there are any errors (generated previously)
29 * then uses the SqlUtility to run reverted database queries of module.sql,
30 * ie. "create table" statement in module.sql is run as drop according table.
32 if (!$msg->containsErrors() && file_exists(dirname(__FILE__) . '/module.sql')) {
33 // deal with the SQL file:
34 require(AT_INCLUDE_PATH . 'classes/sqlutility.class.php');
35 $sqlUtility = new SqlUtility();
38 * the SQL file could be stored anywhere, and named anything, "module.sql" is simply
39 * a convention we're using.
41 $sqlUtility->revertQueryFromFile(dirname(__FILE__) . '/module.sql', TABLE_PREFIX);