Support Forums

Development Forum

uninstalling module in 1.6.2


You must be signed-in to post.

AuthorSubject
  Page: 1
innaz
Subject: uninstalling module in 1.6.2Quote this post in your reply
I have created module_uninstall.php, as required, and trying to unstall an extra module in ATutor 1.6.2. It says in the description that all the db tables that were created in module.sql will be deleted during uninstall.

However, they db tables are NOT getting deleted, but the feedback message says ACTION_COMPLETED_SUCCESSFULLY.


Any idea why?

Thanks,

INna


Operating system ATutor is installed on - Windows XP
ATutor version -1.6.2
Posted: 2009-05-18 14:02:52
greg

Avatar for greg
Subject: Re: uninstalling module in 1.6.2Quote this post in your reply
You need to write the SQL in the module_uninstall.php file to delete the tables.

See the example in the hello world module, which you can install through the module manager.
Posted: 2009-05-19 08:17:41
innaz
Subject: Re: uninstalling module in 1.6.2Quote this post in your reply
Greg, thanks for your reply.

The module_uninstall.php in hello_world is the same as in the module documentation, and it is what I have been using all along. I am pointing to module.sql file, just like in the example. In the module.sql I have several "CREATE TABLE..." commands, and also several "INSERT INTO `language_text` VALUES..." commands.

Each one starts with the new line.

Still, after I uninstall module from the admin menu, the tables are there, and the extra lines in the language_text table are there as well.

The message says Action Peformed Successfully.


I would appreciate any light you can shed on this!

THanks,

Inna
Posted: 2009-05-19 12:51:18
greg

Avatar for greg
Subject: Re: uninstalling module in 1.6.2Quote this post in your reply
The module.sql file in Hello World is an example only. You'd need to write DELETE statements in the uninstall file to remove the tables.
Posted: 2009-05-19 13:37:52
innaz
Subject: Re: uninstalling module in 1.6.2Quote this post in your reply
Greg,


The following is from the module documentation. It seems that according to this, the developer does NOT need to include delete statements in the module_uninstall.php, the code is this file is supposed to run the reverted database queries of module.sql :

/******
* the following code checks if there are any errors (generated previously)
* then uses the SqlUtility to run reverted database queries of module.sql,
* ie. "create table" statement in module.sql is run as drop according table.
*/
if (!$msg->containsErrors() && file_exists(dirname(__FILE__) . '/module.sql')) {
// deal with the SQL file:
require(AT_INCLUDE_PATH . 'classes/sqlutility.class.php');
$sqlUtility =& new SqlUtility();

/*
* the SQL file could be stored anywhere, and named anything, "module.sql" is simply
* a convention we're using.
*/
$sqlUtility->revertQueryFromFile(dirname(__FILE__) . '/module.sql', TABLE_PREFIX);
}
Posted: 2009-05-19 18:09:23
innaz
Subject: Re: uninstalling module in 1.6.2Quote this post in your reply
Greg,

Never mind, I have it figured out.

I have been using the module_uninstall.php file from the online Module Development Documentation, and it is missing the php tags around the code. The code does not complain, just does not get to reverting module.sql commands at all.

Took a while to notice it...

Thanks,

Inna
Posted: 2009-05-19 19:03:30
 Page: 1

You must be signed-in to post.