Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin cron functionailty #2002

Closed
phyzical opened this issue Jul 20, 2024 · 2 comments
Closed

Plugin cron functionailty #2002

phyzical opened this issue Jul 20, 2024 · 2 comments

Comments

@phyzical
Copy link

Hey i've created this plugin to support auto discovery https://github.com/phyzical/autoOrganizr

i was just wondering if there is logic to allow plugins to create a cron to be run in the core of the application?

Just want to run this logic https://github.com/phyzical/autoOrganizr/blob/main/plugin.php#L267 in the background some how

Just to avoid users being forced to click the menu item to sync the tabs

@causefx
Copy link
Owner

causefx commented Jul 20, 2024

yes, just create a cron.php file in plugin root with code like:

<?php
/*
 * Simple Cron job
 */
$GLOBALS['cron'][] = [
	'class' => 'ShuckStop', // Class name of plugin (case-sensitive)
	'enabled' => 'SHUCKSTOP-cron-run-enabled', // Config item for job enable
	'schedule' => 'SHUCKSTOP-cron-run-schedule', // Config item for job schedule
	'function' => '_shuckStopPluginRun', // Function to run during job
];

@phyzical
Copy link
Author

well i feel silly that i didn't even bother to search it...

Thanks for the speedy reply though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants