diff options
author | Brion Vibber <brion@pobox.com> | 2010-10-29 13:41:15 -0700 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-10-29 13:41:15 -0700 |
commit | d743539cf72487705f8a1384284ddf114af12bfa (patch) | |
tree | 89807e892b64b77e4945eaf8d163d9460595ee70 | |
parent | 47eada3a95bbe92619f2fc070f24e429f28e6fa8 (diff) |
Fixups for twitter streaming daemon
-rw-r--r-- | plugins/TwitterBridge/TwitterBridgePlugin.php | 6 | ||||
-rw-r--r-- | plugins/TwitterBridge/daemons/twitterdaemon.php | 27 |
2 files changed, 17 insertions, 16 deletions
diff --git a/plugins/TwitterBridge/TwitterBridgePlugin.php b/plugins/TwitterBridge/TwitterBridgePlugin.php index 128b062c7..b4eb9d2f9 100644 --- a/plugins/TwitterBridge/TwitterBridgePlugin.php +++ b/plugins/TwitterBridge/TwitterBridgePlugin.php @@ -201,8 +201,14 @@ class TwitterBridgePlugin extends Plugin case 'TwitterOAuthClient': case 'TwitterQueueHandler': case 'TwitterImport': + case 'JsonStreamReader': + case 'TwitterStreamReader': include_once $dir . '/' . strtolower($cls) . '.php'; return false; + case 'TwitterSiteStream': + case 'TwitterUserStream': + include_once $dir . '/twitterstreamreader.php'; + return false; case 'Notice_to_status': case 'Twitter_synch_status': include_once $dir . '/' . $cls . '.php'; diff --git a/plugins/TwitterBridge/daemons/twitterdaemon.php b/plugins/TwitterBridge/daemons/twitterdaemon.php index 851d191dd..9e218a1a1 100644 --- a/plugins/TwitterBridge/daemons/twitterdaemon.php +++ b/plugins/TwitterBridge/daemons/twitterdaemon.php @@ -18,7 +18,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); +define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); $shortoptions = 'fi::a'; $longoptions = array('id::', 'foreground', 'all'); @@ -82,13 +82,11 @@ class TwitterMaster extends IoMaster */ function initManagers() { - if (common_config('twitter', 'enabled')) { - $qm = QueueManager::get(); - $qm->setActiveGroup('twitter'); - $this->instantiate($qm); - $this->instantiate(TwitterManager::get()); - $this->instantiate($this->processManager); - } + $qm = QueueManager::get(); + $qm->setActiveGroup('twitter'); + $this->instantiate($qm); + $this->instantiate(new TwitterManager()); + $this->instantiate($this->processManager); } } @@ -103,10 +101,6 @@ class TwitterManager extends IoManager protected $twitterStreams; protected $twitterUsers; - function __construct() - { - } - /** * Pull the site's active Twitter-importing users and start spawning * some data streams for them! @@ -116,6 +110,7 @@ class TwitterManager extends IoManager */ protected function initStreams() { + common_log(LOG_INFO, 'init...'); // Pull Twitter user IDs for all users we want to pull data for $flink = new Foreign_link(); $flink->service = TWITTER_SERVICE; @@ -144,9 +139,9 @@ class TwitterManager extends IoManager * Prepare a Site Stream connection for the given chunk of users. * The actual connection will be opened later. * - * @param $users array of Twitter-side user IDs + * @param $userIds array of Twitter-side user IDs */ - protected function spawnStream($users) + protected function spawnStream($userIds) { $stream = $this->initSiteStream(); $stream->followUsers($userIds); @@ -213,7 +208,7 @@ class TwitterManager extends IoManager $sockets[] = $socket; } } - return $streams; + return $sockets; } /** @@ -272,7 +267,7 @@ class TwitterManager extends IoManager * * @fixme add more event types as we add handling for them */ - protected function setupEvents(TwitterStream $stream) + protected function setupEvents(TwitterStreamReader $stream) { $handlers = array( 'status', |