60ce25da8d246fe30d270c1e31bfa2176c7556fe
[atutor.git] / mods / tle / module_uninstall.php
1 <?php
2 /*******
3  * the line below safe-guards this file from being accessed directly from
4  * a web browser. It will only execute if required from within an ATutor script,
5  * in our case the Module::uninstall() method.
6  */
7 if (!defined('AT_INCLUDE_PATH')) { exit; }
8
9 /******
10  * the following code checks if there are any errors (generated previously)
11  * then uses the SqlUtility to run reverted database queries of module.sql, 
12  * ie. "create table" statement in module.sql is run as drop according table.
13  */
14 if (!$msg->containsErrors() && file_exists(dirname(__FILE__) . '/module.sql')) {
15         // deal with the SQL file:
16         require(AT_INCLUDE_PATH . 'classes/sqlutility.class.php');
17         $sqlUtility = new SqlUtility();
18
19         /*
20          * the SQL file could be stored anywhere, and named anything, "module.sql" is simply
21          * a convention we're using.
22          */
23         $sqlUtility->revertQueryFromFile(dirname(__FILE__) . '/module.sql', TABLE_PREFIX);
24 }
25
26 ?>