forked from CampFireManager/cfm2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cron.php
54 lines (52 loc) · 1.64 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
<?php
/**
* CampFire Manager is a scheduling tool predominently used at BarCamps to
* schedule talks based, mainly, on the number of people attending each talk
* receives.
*
* PHP version 5
*
* @category Default
* @package CampFireManager2
* @author Jon Spriggs <[email protected]>
* @license http://www.gnu.org/licenses/agpl.html AGPLv3
* @link https://github.com/JonTheNiceGuy/cfm2 Version Control Service
*/
/**
* This file defines the autoloader for the classes mentioned elsewhere.
*/
require_once dirname(__FILE__) . '/classes/autoloader.php';
$objRequest = Container_Request::getRequest();
if ($objRequest->get_strRequestMethod() != 'file') {
die("Must only be run from the command line.");
}
$forever = true;
foreach ($objRequest->get_arrRqstParameters() as $key => $parameter) {
if ($key == '--once' || $parameter == '--once') {
$forever = false;
}
}
do {
echo "About to run cron tasks at " . date('Y-m-d H:i:s') . "\r\n";
echo "(1/5) Flushing cache: ";
Base_Cache::flush();
echo "Done\r\n";
echo "(2/5) Loading config: ";
Container_Config::LoadConfig();
echo "Done\r\n";
echo "(3/5) Sleeping to reduce server load: ";
if ($forever) {
sleep(Container_Config::brokerByID('Sleep In Cron Script', '5')->getKey('value'));
}
echo "Awake\r\n";
echo "(4/5) Loading hook processes: ";
$hook = new Base_Hook();
$hook->Load('plugin.php');
echo "Done\r\n";
echo "(5/5) Triggering cron hooks: \r\n";
$hook->triggerHook('cronTick');
echo "Done\r\n";
if ($forever) {
echo "\r\n=========================================\r\n\r\n";
}
} while ($forever);