changed git call from https to git readonly
[atutor.git] / mods / flowplayer / module_uninstall.php
1 <?php\r
2 /*******\r
3  * module_uninstall.php performs reversion of module_install.php\r
4  */\r
5 \r
6 /*******\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
10  */\r
11 if (!defined('AT_INCLUDE_PATH')) { exit; }\r
12 \r
13 /********\r
14  * the following code is used for removing a module-specific directory created in module_install.php.\r
15  * it generates appropriate error messages to aid in its creation.\r
16  */\r
17 $directory = AT_CONTENT_DIR .'hello_world';\r
18 \r
19 // check if the directory exists\r
20 if (is_dir($directory)) {\r
21         require(AT_INCLUDE_PATH.'lib/filemanager.inc.php');\r
22 \r
23         if (!clr_dir($directory))\r
24                 $msg->addError(array('MODULE_UNINSTALL', '<li>'.$directory.' can not be removed. Please manually remove it.</li>'));\r
25 }\r
26 \r
27 /******\r
28  * the following code checks if there are any errors (generated previously)\r
29  * then uses the SqlUtility to run reverted database queries of module.sql, \r
30  * ie. "create table" statement in module.sql is run as drop according table.\r
31  */\r
32 if (!$msg->containsErrors() && file_exists(dirname(__FILE__) . '/module.sql')) {\r
33         // deal with the SQL file:\r
34         require(AT_INCLUDE_PATH . 'classes/sqlutility.class.php');\r
35         $sqlUtility =& new SqlUtility();\r
36 \r
37         /*\r
38          * the SQL file could be stored anywhere, and named anything, "module.sql" is simply\r
39          * a convention we're using.\r
40          */\r
41         $sqlUtility->revertQueryFromFile(dirname(__FILE__) . '/module.sql', TABLE_PREFIX);\r
42 }\r
43 \r
44 ?>