forked from CampFireManager/cfm2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
glue.php
60 lines (57 loc) · 1.83 KB
/
glue.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
<?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';
Container_Config::LoadConfig();
$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;
}
}
Object_User::isSystem(true);
$arrGlues = Glue_Broker::brokerAll();
do {
echo "About to run glues at " . date('Y-m-d H:i:s') . "\r\n";
foreach ($arrGlues as $objGlue) {
echo "Glue: " . $objGlue->getGlue() . "\r\n";
echo " * Following followers: ";
$objGlue->follow_followers();
echo "Done\r\n";
echo " * Reading private messages: ";
$objGlue->read_private();
echo "Done\r\n";
echo " * Reading public messages: ";
$objGlue->read_public();
echo "Done\r\n";
echo " * Sending messages: ";
$objGlue->send();
echo "Done\r\n";
}
echo "Sleeping to reduce server load: ";
if ($forever) {
sleep(Container_Config::brokerByID('Sleep In Cron Script', '5')->getKey('value'));
}
echo "Awake\r\n";
if ($forever) {
echo "\r\n=========================================\r\n\r\n";
}
} while ($forever);