2 /***********************************************************************/
\r
4 /***********************************************************************/
\r
5 /* Copyright (c) 2002-2009 */
\r
6 /* Adaptive Technology Resource Centre / Inclusive Design Institution */
\r
7 /* http://atutor.ca */
\r
9 /* This program is free software. You can redistribute it and/or */
\r
10 /* modify it under the terms of the GNU General Public License */
\r
11 /* as published by the Free Software Foundation. */
\r
12 /***********************************************************************/
\r
16 * module_uninstall.php performs reversion of module_install.php
\r
20 * the line below safe-guards this file from being accessed directly from
\r
21 * a web browser. It will only execute if required from within an ATutor script,
\r
22 * in our case the Module::uninstall() method.
\r
24 if (!defined('AT_INCLUDE_PATH')) { exit; }
\r
27 * the following code is used for removing a module-specific directory created in module_install.php.
\r
28 * it generates appropriate error messages to aid in its creation.
\r
30 $directory = AT_PA_CONTENT_DIR;
\r
33 * the following code checks if there are any errors (generated previously)
\r
34 * then uses the SqlUtility to run reverted database queries of module.sql,
\r
35 * ie. "create table" statement in module.sql is run as drop according table.
\r
37 if (!$msg->containsErrors() && file_exists(dirname(__FILE__) . '/module.sql')) {
\r
38 // deal with the SQL file:
\r
39 require(AT_INCLUDE_PATH . 'classes/sqlutility.class.php');
\r
40 $sqlUtility =& new SqlUtility();
\r
43 * the SQL file could be stored anywhere, and named anything, "module.sql" is simply
\r
44 * a convention we're using.
\r
46 $sqlUtility->revertQueryFromFile(dirname(__FILE__) . '/module.sql', TABLE_PREFIX);
\r