I have some requirements the current plugin system does not fulfill. Would you accept the following changes / additions (as a PR 😉)?
Settings
The plugin-name.meta file allows to set parameter descriptions. I want to introduce another optional possibility:
Defining type.<PARAMETER_NAME> and setting it to string value of either string (default), bool or number will lead to a rendered text field, checkbox or number input field in the plugin administration, and save the values with the corresponding type in the configuration when changed.
Might break plugin administration of external themes.
Might get extended by additional types (e.g. enums rendering to radio button list).
New Hooks
activated: the plugin is now activated (was deactivated before). not triggered for default plugin(s) upon setup, only for manual activation.
deactivated: the plugin is now deactivated (was activated before), do e.g. some cleanup
cronjob: cronjob handler, see API addition below
REST API addition
I want to introduce a new endpoint, GET /cronjob. All it does is to trigger the cronjob hook (see above) of all supported and activated plugins. I need this for plugins to e.g. check the status of a link (is the page still available? has it changed?) and cleanup of e.g. cancelled or timeouted uploads. Currently I see now way to trigger the plugins regularly to do these kinds of lookups or cleanups.
The interval of cronjob invocation would be up to the user, and cronjoob hook would get the date and time of the last run in order to do some timing. Finally Shaarli itself could use this handler to do some (optional) cleanup as well.
I have some requirements the current plugin system does not fulfill. Would you accept the following changes / additions (as a PR 😉)?
Settings
The plugin-name.meta file allows to set parameter descriptions. I want to introduce another optional possibility:
Defining
type.<PARAMETER_NAME>and setting it to string value of eitherstring(default),boolornumberwill lead to a rendered text field, checkbox or number input field in the plugin administration, and save the values with the corresponding type in the configuration when changed.Might break plugin administration of external themes.
Might get extended by additional types (e.g. enums rendering to radio button list).
New Hooks
activated: the plugin is now activated (was deactivated before). not triggered for default plugin(s) upon setup, only for manual activation.deactivated: the plugin is now deactivated (was activated before), do e.g. some cleanupcronjob: cronjob handler, see API addition belowREST API addition
I want to introduce a new endpoint,
GET /cronjob. All it does is to trigger thecronjobhook (see above) of all supported and activated plugins. I need this for plugins to e.g. check the status of a link (is the page still available? has it changed?) and cleanup of e.g. cancelled or timeouted uploads. Currently I see now way to trigger the plugins regularly to do these kinds of lookups or cleanups.The interval of cronjob invocation would be up to the user, and
cronjoobhook would get the date and time of the last run in order to do some timing. Finally Shaarli itself could use this handler to do some (optional) cleanup as well.