forked from ryanhowdy/fcms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cron.php
79 lines (62 loc) · 1.48 KB
/
cron.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/**
* Cron
*
* Part of the FCMS Scheduler, which allows users without cron to run scheduled jobs.
*
* Sending a asynchronous POST request to this file will not slow down the user while
* the scheduled jobs are being run.
*
* PHP versions 4 and 5
*
* @category FCMS
* @package FamilyConnections
* @author Ryan Haudenschilt <r.haudenschilt@gmail.com>
* @copyright 2011 Haudenschilt LLC
* @license http://www.gnu.org/licenses/gpl-2.0.html GPLv2
* @link http://www.familycms.com/wiki/
* @since 2.6
*/
require 'fcms.php';
load('cron');
if (isset($_POST['job_type']))
{
$jobType = $_POST['job_type'];
}
elseif (isset($argv[1]) && substr($argv[1], 0, 8) == 'job_type')
{
$jobType = substr($argv[1], 9);
}
else
{
logError(__FILE__.' ['.__LINE__.'] - No job type given.');
die('No job type given');
}
// Stop, if we are currently running a job
if (runningJob() or defined('RUNNING_JOB'))
{
logError(__FILE__.' ['.__LINE__.'] - Cron Job already running.');
die('Cron Job already running');
}
define('RUNNING_JOB', true);
runJob();
switch ($jobType)
{
case 'awards':
runAwardsJob();
break;
case 'familynews':
runFamilyNewsJob();
break;
case 'youtube':
runYouTubeJob();
break;
case 'instagram':
runInstagramJob();
break;
default:
logError(__FILE__.' ['.__LINE__.'] - Invalid job type given ['.$jobType.'].');
break;
}
stopJob();
die('Done');