[wp-hackers] Meta tables: Take 5
Aaron D. Campbell
aaron at xavisys.com
Fri Jul 24 17:49:26 UTC 2009
Taking the examples given, you can't drop it when it's empty because the
plugin would check for it on activation. For example:
* Plugin A activates and creates a comment meta table.
* Plugin A adds a couple things to the comment meta table.
* Plugin B activates and sees that a comment table already exists
* Plugin A is removed as are it's entries in the comment meta table.
Now the table is empty but if you remove it plugin B will have
problems. I think you'd actually have to implement some sort of
reference count if you want to be able to remove the tables.
However, plugins can already add tables, it's done quite often. It
seems that the meta data solution should really just meet the 80/20 rule
and a plugin can always create their own tables if they need something
specific.
Otto wrote:
> On Fri, Jul 24, 2009 at 5:21 AM, scribu<scribu at gmail.com> wrote:
>
>> ...
>> add_meta('comment', $comment_id, $meta_key, $meta_value);
>> ...
>>
>
> Oh, also, combining all the meta code together into a set of combined
> functions is a damn good idea, even if they do use separate tables.
>
> However, I'm not certain about creating meta tables on the fly yet.
> This runs into a plugin uninstall issue to me. The metadata can be
> removed, but how do you remove the table when other plugins might use
> it as well? Check when it's empty then drop it? Seems error prone.
>
>
> -Otto
> Sent from Memphis, TN, United States
>
More information about the wp-hackers
mailing list