]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Fixups for twitter streaming daemon
authorBrion Vibber <brion@pobox.com>
Fri, 29 Oct 2010 20:41:15 +0000 (13:41 -0700)
committerBrion Vibber <brion@pobox.com>
Fri, 29 Oct 2010 20:41:15 +0000 (13:41 -0700)
plugins/TwitterBridge/TwitterBridgePlugin.php
plugins/TwitterBridge/daemons/twitterdaemon.php

index 128b062c7f6ef8819f97e5e30a1596542354f043..b4eb9d2f981b9e8f70682510fdae82b00a22ec17 100644 (file)
@@ -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';
index 851d191dd2296fe5a02f2ae3e84f77288975fd80..9e218a1a1cbca07e65539fde1188dd446b452057 100644 (file)
@@ -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',