changed git call from https to git readonly
[atutor.git] / mods / scorm_packages / 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 $directory = realpath(AT_INCLUDE_PATH . '../') . '/sco'; // a top level directory\r
14 \r
15 // check if the directory exists\r
16 if (is_dir($directory)) {\r
17         require(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');\r
18 \r
19         if (!clr_dir($directory))\r
20                 $msg->addError(array('MODULE_UNINSTALL', '<li>'.$directory.' can not be removed. Please manually remove it.</li>'));\r
21 }\r
22 \r
23 /******\r
24  * the following code checks if there are any errors (generated previously)\r
25  * then uses the SqlUtility to run reverted database queries of module.sql, \r
26  * ie. "create table" statement in module.sql is run as drop according table.\r
27  */\r
28 if (!$msg->containsErrors() && file_exists(dirname(__FILE__) . '/module.sql')) {\r
29   // deal with the SQL file:\r
30   require(AT_INCLUDE_PATH . 'classes/sqlutility.class.php');\r
31   $sqlUtility = new SqlUtility();\r
32   $sqlUtility->revertQueryFromFile(dirname(__FILE__) . '/module.sql', TABLE_PREFIX);\r
33 }\r
34 \r
35 ?>