Added TwitterStatusFetcher into daemon startup and shutdown subsystem

This commit is contained in:
Zach Copley 2009-05-07 02:07:31 -07:00
parent 856e05a08f
commit bc190595d1
5 changed files with 15 additions and 5 deletions

View File

@ -150,6 +150,9 @@ $config['sphinx']['port'] = 3312;
#$config['memcached']['server'] = 'localhost'; #$config['memcached']['server'] = 'localhost';
#$config['memcached']['port'] = 11211; #$config['memcached']['port'] = 11211;
# Enable bidirectional Twitter bridge
#$config['twitterbridge']['enabled'] = true;
#Twitter integration source attribute. Note: default is Laconica #Twitter integration source attribute. Note: default is Laconica
#$config['integration']['source'] = 'Laconica'; #$config['integration']['source'] = 'Laconica';

View File

@ -143,6 +143,8 @@ $config =
array('piddir' => '/var/run', array('piddir' => '/var/run',
'user' => false, 'user' => false,
'group' => false), 'group' => false),
'twitterbridge' =>
array('enabled' => false),
'integration' => 'integration' =>
array('source' => 'Laconica', # source attribute for Twitter array('source' => 'Laconica', # source attribute for Twitter
'taguri' => $_server.',2009'), # base for tag URIs 'taguri' => $_server.',2009'), # base for tag URIs

View File

@ -44,6 +44,9 @@ if(common_config('xmpp','enabled')) {
if(common_config('memcached','enabled')) { if(common_config('memcached','enabled')) {
echo "memcachedqueuehandler.php "; echo "memcachedqueuehandler.php ";
} }
if(common_config('twitterbridge','enabled')) {
echo "twitterstatusfetcher.php ";
}
echo "ombqueuehandler.php "; echo "ombqueuehandler.php ";
echo "twitterqueuehandler.php "; echo "twitterqueuehandler.php ";
echo "facebookqueuehandler.php "; echo "facebookqueuehandler.php ";

View File

@ -25,7 +25,7 @@ DIR=`php $SDIR/getpiddir.php`
for f in jabberhandler ombhandler publichandler smshandler pinghandler \ for f in jabberhandler ombhandler publichandler smshandler pinghandler \
xmppconfirmhandler xmppdaemon twitterhandler facebookhandler \ xmppconfirmhandler xmppdaemon twitterhandler facebookhandler \
memcachehandler inboxhandler; do memcachehandler inboxhandler twitterstatusfetcher; do
FILES="$DIR/$f.*.pid" FILES="$DIR/$f.*.pid"
for ff in "$FILES" ; do for ff in "$FILES" ; do

View File

@ -32,7 +32,7 @@ define('LACONICA', true);
define('MAXCHILDREN', 2); define('MAXCHILDREN', 2);
define('POLL_INTERVAL', 60); // in seconds define('POLL_INTERVAL', 60); // in seconds
// Uncomment this to get useful console output // Uncomment this to get useful logging
define('SCRIPT_DEBUG', true); define('SCRIPT_DEBUG', true);
require_once(INSTALLDIR . '/lib/common.php'); require_once(INSTALLDIR . '/lib/common.php');
@ -45,7 +45,7 @@ class TwitterStatusFetcher extends Daemon
function name() function name()
{ {
return 'twitterstatusfetcher'; return ('twitterstatusfetcher.generic');
} }
function run() function run()
@ -130,7 +130,9 @@ class TwitterStatusFetcher extends Daemon
' secs before hitting Twitter again.'); ' secs before hitting Twitter again.');
} }
sleep(POLL_INTERVAL); if (POLL_INTERVAL > 0) {
sleep(POLL_INTERVAL);
}
} while (true); } while (true);
} }
@ -282,7 +284,7 @@ class TwitterStatusFetcher extends Daemon
// XXX: Figure out a better way to link Twitter replies? // XXX: Figure out a better way to link Twitter replies?
$notice->saveReplies(); $notice->saveReplies();
// XXX: Do we want to polute our tag cloud with // XXX: Do we want to pollute our tag cloud with
// hashtags from Twitter? // hashtags from Twitter?
$notice->saveTags(); $notice->saveTags();
$notice->saveGroups(); $notice->saveGroups();