How to fully remove an app

Hello everyone,

I run several ownCloud 10.2.1 instances with MySQL. I’ve installed the app richdocuments with occ. My questions won’t be specific to this app, but to the whole behavior of the market.

occ market:install richdocuments

After further testing I’m not satisfied with the app, but it’s not the matter here, so I uninstalled it, still using occ.

occ app:disable richdocuments
occ market:uninstall richdocuments

The app is not to be shown in the UI and I’m happy but after a thorough check of my database, I observed some remains are still around.

mysql> select * from oc_appconfig where appId like 'richdocuments';
+---------------+-------------------+---------------------------+
| appid         | configkey         | configvalue               |
+---------------+-------------------+---------------------------+
| richdocuments | enabled           | no                        |
| richdocuments | installed_version | 2.1.2                     |
| richdocuments | signed            | true                      |
| richdocuments | types             | prevent_group_restriction |
+---------------+-------------------+---------------------------+
4 rows in set (0.00 sec)

And worse it has created a table and it won’t go away with the uninstall process.

mysql> show tables like 'oc_richdocuments%';
+------------------------------------------+
| Tables_in_xxx (oc_richdocuments%) |
+------------------------------------------+
| oc_richdocuments_wopi                    |
+------------------------------------------+
1 row in set (0.00 sec)

So here are my questions:

  • Why when using occ market:uninstall [app] are the app’s information still kept in the oc_appconfig ? It should completely disappear since I did not only disable the app.

  • Running occ market:uninstall [app], why is there no postdelete script to clean up the database ? The directory containing the app is well removed. This question may apply only to richdocuments since yet I couldn’t find remains of an official one.

As an additional note, since gallery and Video Player apps are replaced by files_mediaviewer my question applies also to ownCloud’s official apps. Once moving to files_mediaviewer and thus uninstalling the others, IMHO the database should stay cleaned.

Thanks.

Although I agree with you, I’ll play the devil’s advocate.
Neither the market app nor core have any idea of what any app has done. The app might create its own tables, but it could also create its own files in the FS, access to external servers to store information, etc, so it’s the app’s responsability to clean after itself.

Regarding the postdelete script, I think one of the historical reasons not to have such script was to enable or reinstall the app without losing information. No idea if this still applies.

I think your best bet is to ask the app maintainer for a way to remove all the stuff the app has created.

I appreciate that feature, for me it’s very useful.

OTOH the app devs could give an option to export and finally remove their stuff during the uninstall process. This would allow keep the DB clean.

In the meantime I have collected tons of such obsoleted app-data in my db.

1 Like

Hello people,

and thanks for your answers :slight_smile:
I’ve quoted your replies in some ordered way, I believe :joy:

It’s true though a postdelete script could (even should) be shipped in every app to take care of its files, crons, databases, etc … I checked the app documentation but didn’t find any global rules for that, I still think it would be a good thing.

Yup, I think it could be a PHP function you must code once you extend the OCP\AppFramework\Controller for example. Or anyting that runs a cascade when you do occ market:uninstall [app] to delete in the database global informations of the app in oc_appconfig then all the stuff of the app.

Yes it’s what I think too, nonetheless there are two functions occ app:disable [app] and occ market:uninstall [app], the first one does what you pinpoint but the second one should fully erase.

True but this feature should only act when doing occ app:disable [app]

That’s what I try to fight :worried:

Yes I guess I have no choice concerning richdocuments. But for gallery which will become obsolete, it would be nice to have it removed from oc_appconfig.

Thanks.

2 Likes

jvillafanez,

I’m facing the same issue and I do not agree with the devil’s advocate :wink:

At least the entries from oc_appconfig must be removed (I consider this as a bug).
When a user does not have db experience it would never be possible to downgrade an app (eg. when a newer version breaks something).

This is not so sure, too. There is either a schema or the migrations, so in theory oC could know, what the app was doing.

1 Like

Hey,

i have seen a similar approach for the “Simple Machines Forums” where the uninstall of a forums modification provide a checkbox like “delete database tables” for such cases.

By default this checkbox is not ticked so the user is always able to re-install the mod without loosing the database entries used by that mod.

1 Like

Hello,

well I doubt there will ever be some fix for that since it’s not “really important”, but for anyone that is interested I decided to go with simple bare SQL once I uninstalled some apps:

mysql>
use [your_ownCloud];
delete from oc_appconfig where appId IN ('[app_name1]', '[app_name2]');

Obviously delete only what you removed from occ market:uninstall.
Keep in mind it won’t clean extra tables from apps such as richdocuments.

Cheers.

1 Like