Delete specific Contenttype Attachments

  • Thread starter Thread starter ragtek
  • Start date Start date
R

ragtek

Guest
I have several ADd-ons using an own attachment handler.

When i uninstall the add-on, the attachments are still in the database, associated to articles and my downloadmanager.

So when i install the add-on again, the attachments will be shown again in the new articles.

Is there a method providen by the framework i can use on uninstall, or do i need to delete them which an own query?

thx
 
You'd need to delete them with your own query - or at least remove the association.
 
Would it be possible, that you guys create some delete methods for the node & content type models, so that 3rd party add-ons which are creating own contenttypes & nodetypes could use them for the unstinall process?
I think this should be handled with the framework and not through "own uninstall code"


I'm working on our uninstall code and it "sucks" a little bit.

I have to:

1. delete my own tables
2. delete the new node type from the node_type table
3. delete all existing nodes with my own node type
4. delete own content types from xf_content_type
5. delete own content type fields from xf_content_type_field
6. delete attachments from attachment, attachment_data & attachment_view or unassociate the attachments associated to this content_type

thx
ajnos
 
...- or at least remove the association.
PHP:
      $queries['delete_attachments'] = "
        UPDATE xf_attachment
        set unassociated = 1
        WHERE content_type = '" . Ragtek_AS_Constants::CONTENT_TYPE . "'
        ";
It seems that this is the easiest way, because the cleanup cronjob would delete them:)
 
Oh man:(
There are much more things, where the uninstall code needs to take care:(
It also needs to delete all mod & reportcenter entries:(, likes, alerts, news,etc...

It would be really nice, if this should be handled by the framework
 
Top Bottom