PluginProbe
VikBooking Hotel Booking Engine & PMS / trunk
VikBooking Hotel Booking Engine & PMS vtrunk
1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.7.3 All 36 releases
vikbooking / admin / helpers / src / help / wizard / helper / cron.php

cron.php in VikBooking Hotel Booking Engine & PMS trunk, at admin/helpers/src/help/wizard/helper/cron.php

81 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package VikBooking
4 * @subpackage core
5 * @author E4J s.r.l.
6 * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved.
7 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
8 * @link https://vikwp.com
9 */
10
11 // No direct access
12 defined('ABSPATH') or die('No script kiddies please!');
13
14 /**
15 * Cron job wizard helper class.
16 *
17 * @since 1.18.2 (J) - 1.8.2 (WP)
18 */
19 class VBOHelpWizardHelperCron
20 {
21 /**
22 * A list of cached cron jobs.
23 *
24 * @var array
25 */
26 protected static $crons = null;
27
28 /**
29 * Returns the report_auto_exporter cron job configured for the specified report ID, if any.
30 *
31 * @param string $reportId
32 *
33 * @return array|null
34 */
35 public static function getAutoExport(string $reportId)
36 {
37 foreach (static::getList() as $cron) {
38 if ($cron['class_file'] !== 'report_auto_exporter') {
39 continue;
40 }
41
42 if (strcasecmp($cron['params']['report'] ?? '', $reportId)) {
43 continue;
44 }
45
46 return $cron;
47 }
48
49 return null;
50 }
51
52 /**
53 * Returns the list of supported cron jobs.
54 *
55 * @return array
56 */
57 public static function getList()
58 {
59 if (is_null(static::$crons)) {
60 static::$crons = [];
61
62 $db = JFactory::getDbo();
63
64 $query = $db->getQuery(true)
65 ->select($db->qn(['id', 'class_file', 'params', 'published']))
66 ->from($db->qn('#__vikbooking_cronjobs'));
67
68 $db->setQuery($query);
69
70 foreach ($db->loadAssocList() as $cron)
71 {
72 $cron['params'] = $cron['params'] ? json_decode($cron['params'], true) : [];
73
74 static::$crons[] = $cron;
75 }
76 }
77
78 return static::$crons;
79 }
80 }
81