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';
* 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');
*/
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);
}
}
protected $twitterStreams;
protected $twitterUsers;
- function __construct()
- {
- }
-
/**
* Pull the site's active Twitter-importing users and start spawning
* some data streams for them!
*/
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;
* 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);
$sockets[] = $socket;
}
}
- return $streams;
+ return $sockets;
}
/**
*
* @fixme add more event types as we add handling for them
*/
- protected function setupEvents(TwitterStream $stream)
+ protected function setupEvents(TwitterStreamReader $stream)
{
$handlers = array(
'status',