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