-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_twitter_bot.php
39 lines (26 loc) · 1.19 KB
/
update_twitter_bot.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
<?php
require_once "bot.php";
header("Content-Type: text/plain");
ob_start(); //start output buffer
log_this("\_________ update script called", hash('sha256', $_SERVER['REMOTE_ADDR'])); // logs all calls of the update sript
foreach($bots as $name => $bot){
log_this("–––––––––––– processing bot '$name'");
echo "** BOT '$name' running \n*****************************\n";
log_and_flush(); //Log and flush the output buffer :)
$db_events_table = $name."_events"; // every bot gets his own table to log events
//clear_logged_events(); // reset the bot
process($bot, !table_exists($db_events_table));
/*
If the events table does not exists nothing will be twittered.
This way old stuff wont be twittered in the first run.
Instead the table is created and logs the old events.
*/
summary_tweet($bot); //Daily summary.
echo "\n\n\n\n";
//print_table($db_events_table); // shows all logged events for debugging
}
log_and_flush(); //Log and flush the output buffer for the last time
ob_end_clean(); //end output buffer
log_this("––––––––––––– done. ", $log); //write the output of this script to the log table
mysql_close(DB);
?>