2 /*==============================================================
\r
4 ==============================================================
\r
5 Copyright (c) 2006 by Dylan Cheon & Kelvin Wong
\r
6 Institute for Assistive Technology / University of Victoria
\r
7 http://www.canassist.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
17 * @desc This file installs the photo album module
\r
18 * @author Dylan Cheon & Kelvin Wong
\r
19 * @copyright 2006, Institute for Assistive Technology / University of Victoria
\r
20 * @link http://www.canassist.ca/
\r
25 * @desc the line below safe-guards this file from being accessed directly from a web browser. It will only execute if required from within an ATutor script, in our case the Module::uninstall() method.
\r
27 if (!defined('AT_INCLUDE_PATH')) { exit; }
\r
28 if (!defined('AT_MODULE_PATH')) { exit; }
\r
29 //define('AT_MODULE_PATH', realpath(AT_INCLUDE_PATH.'../mods') . DIRECTORY_SEPARATOR);
\r
32 * the following code is used for removing a module-specific directory created in module_install.php.
\r
33 * it generates appropriate error messages to aid in its creation.
\r
35 $pa_array[0]=AT_CONTENT_DIR.'photo_album';
\r
37 // check if the directory exists
\r
38 foreach ($pa_array as $directory){
\r
39 if (is_dir($directory)) {
\r
40 require(AT_INCLUDE_PATH.'lib/filemanager.inc.php');
\r
42 if (!clr_dir($directory))
\r
43 $msg->addError(array('MODULE_UNINSTALL', '<li>'.$directory.' can not be removed. Please manually remove it.</li>'));
\r
48 * the following code checks if there are any errors (generated previously)
\r
49 * then uses the SqlUtility to run reverted database queries of module.sql,
\r
50 * ie. "create table" statement in module.sql is run as drop according table.
\r
52 if (!$msg->containsErrors() && file_exists(dirname(__FILE__) . '/module.sql')) {
\r
53 // deal with the SQL file:
\r
54 require(AT_INCLUDE_PATH . 'classes/sqlutility.class.php');
\r
55 $sqlUtility =& new SqlUtility();
\r
58 * the SQL file could be stored anywhere, and named anything, "module.sql" is simply
\r
59 * a convention we're using.
\r
61 $sqlUtility->revertQueryFromFile(dirname(__FILE__) . '/module.sql', TABLE_PREFIX);
\r