That's an excellent question. I've CC'd this to the developers list.
There's a comment in the code that asks if we should be unregistering
the 'PreApproved' type. I haven't looked into the implications of
unregistering a type (yet); perhaps someone can now say if it's a bad
idea? The evidence above suggests it may be ...
--
Michael C. Harris, School of CS&IT, RMIT University
http://twofishcreative.com/michael/blog
I don't like the idea of unregistering log types when the plugin that
provides that log type is deactivated. It means that there could be
logs stored in the DB for which no log type is defined.
For the record, I also dislike the idea of removing statuses and
content type indicators when plugins that create them are deactivated.
Can someone provide a compelling argument for why it would be
beneficial to remove a log type, status type, or content type record
when the associated plugin is disabled?
Just to follow up here, the consequence to unregistering a log type is
that any log entries that reference that type get marked as
"Unknown". As such, I would think it is not desirable to remove the
log type when there still exist entries in the log associated with
that type.
As for adding log types, apparently they are added automatically when
writing to the log (by LogEntry::type() called by
LogEntry::insert()). So does one even need to register a log type
when activating a plugin?
BTW, the reason the PreApproved plugin was causing an internal server
error is because it passed only one argument to the two-argument
function register_type, which has the second argument ('module') set
to null by default, but the schema of the log_types table disallows
nulls for 'module' or 'type'.
- Braden
In that case it seems that it's good practice to unregister. Is that
right? If so, we should document that.
We are talking about log types though, right? Caius was talking about
post types.
Currently, when one unregisters a log type, it simply gets deleted.
It is true that it doesn't seem right to delete the log type when
there might exist log messages of that type.
Caius, are you suggesting that log types should instead be handled the
same way as post types?
- Braden