causefx / Organizr

HTPC/Homelab Services Organizer - Written in PHP
GNU General Public License v3.0
5.08k stars 289 forks source link

Plugin cron functionailty #2002

Closed phyzical closed 1 month ago

phyzical commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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

Thanks for the speedy reply though!