Advertisement:

Drop table after uninstalling the mod

Aloittaja Mr. Pedram, kesäkuu 04, 2014, 04:02:47 AP

« edellinen - seuraava »

Mr. Pedram

I working on a mod, it will install successfully and also uninstall perfectly but one thing will left behind, the table that mod created won't drop after mod uninstalled.

uninstall part:

Koodi (package-info.xml) [Valitse]
<uninstall for="2.0 - 2.0.99">
<modification reverse="true">install.xml</modification>
<database>uninstall.php</database>
</uninstall>


uninstall file for database:

Koodi (uninstall.php) [Valitse]
<?php
if (!defined('SMF'))
die('Hacking attempt...');

global 
$smcFunc;

$smcFunc['db_drop_table'] ('{db_prefix}mytesttable');
?>


what's wrong?
i see this happened before for other mod, like thank-o-matic or etc..
it's normal?! or i missed something?

no error from database/or/php
and tested on localhost, nothing in error log
My Modifications:
» Loading For SMF
» Buddies Block
» Redirect Links
» Birthdate On Registration
» PM Warning
» Instagram
» Add Table,Td,Tr Button
» Search Topic & Board Button
Browse All...

margarett

You don't need to do that. As long as you create the table with adequate $smcFunc functions (and we will ask you to do it), SMF (2.0+) will log that and offer the user the possibility to remove it at uninstall. You don't need any code/database for uninstall.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Mr. Pedram

Lainaus käyttäjältä: margarett - kesäkuu 04, 2014, 04:06:33 AP
You don't need to do that. As long as you create the table with adequate $smcFunc functions (and we will ask you to do it), SMF (2.0+) will log that and offer the user the possibility to remove it at uninstall. You don't need any code/database for uninstall.

Oh, you right, now i remember that option..

LainaaRemove all data associated with this modification.

Thank you for answer.

My Modifications:
» Loading For SMF
» Buddies Block
» Redirect Links
» Birthdate On Registration
» PM Warning
» Instagram
» Add Table,Td,Tr Button
» Search Topic & Board Button
Browse All...

butchs

With SMF 2.0 you will need uninstall code for "scheduled_tasks" and changing DB values to turn off a mod.

I have been uninstalling and re-installing a bunch lately and I noticed that with SMF 2.0 &  2.1 asking to drop mod tables seems to be an infrequent thing.
I have been truly inspired by the SUGGESTIONS as I sit on my throne and contemplate the wisdom imposed upon me.

Arantor

If you're not being asked, you're probably not setting it up correctly in the first place.
Holder of controversial views, all of which my own.


butchs

I have been truly inspired by the SUGGESTIONS as I sit on my throne and contemplate the wisdom imposed upon me.

margarett

One time, yes. Because at that time the tables/columns were in fact created.

If, at uninstall, you choose not to remove data, when you reinstall, those tables/columns will not be recreated and, as such, you will not be offered them again ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Arantor

That sounds suspiciously like a bug to me.
Holder of controversial views, all of which my own.


margarett

Really? That's how it always behaved for me so I thought of it as a feature, not a bug :P

Usually MOD installers only call $smcFunc with add column/add table if they don't exist already. So it they do exist already, that install will not create them and, as such, they are not logged for uninstall. Makes sense for me... Not?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Arantor

Consider the following situation:
1. Install mod.
2. Uninstall mod, not deleting data.
3. Install updated version of mod.
4. Uninstall mod, no longer desired.

Is the data now left behind without option to remove it?
Holder of controversial views, all of which my own.


margarett

Errr... Yes? :P

I see your point and of course it makes sense. It's just that it always worked like that for me (IIRC) so I got used to it.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Arantor

That's one of my central arguments... we have gotten too used to how things are that we no longer question whether it is correct that it should be so.
Holder of controversial views, all of which my own.


margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Advertisement: