Body_Classes.php
2 weeks ago
Crons.php
2 weeks ago
Debug_Bar.php
2 weeks ago
Dialog.php
2 weeks ago
PUE.php
2 weeks ago
Processes.php
2 weeks ago
Promoter.php
2 weeks ago
Shortcodes.php
2 weeks ago
Tooltip.php
2 weeks ago
Widgets.php
2 weeks ago
Crons.php
38 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Handles common cron functions. |
| 4 | * |
| 5 | * @since 4.12.6 |
| 6 | * |
| 7 | * @package Tribe\Service_Providers |
| 8 | */ |
| 9 | |
| 10 | namespace Tribe\Service_Providers; |
| 11 | |
| 12 | use Tribe\DB_Lock; |
| 13 | |
| 14 | /** |
| 15 | * Class Crons |
| 16 | * |
| 17 | * @since 4.12.6 |
| 18 | * |
| 19 | * @package Tribe\Service_Providers |
| 20 | */ |
| 21 | class Crons extends \tad_DI52_ServiceProvider { |
| 22 | |
| 23 | /** |
| 24 | * Registers the filters required by the provider to manage cron processes. |
| 25 | * |
| 26 | * @since 4.12.6 |
| 27 | */ |
| 28 | public function register() { |
| 29 | // Schedule a cron event happening once a day. |
| 30 | if ( ! wp_get_schedule( 'tribe_daily_cron' ) ) { |
| 31 | wp_schedule_event( time(), 'daily', 'tribe_daily_cron' ); |
| 32 | } |
| 33 | |
| 34 | // Register actions that should happen on that hook. |
| 35 | add_action( 'tribe_daily_cron', [ DB_Lock::class, 'prune_stale_db_locks' ] ); |
| 36 | } |
| 37 | } |
| 38 |