forked from GNUsocial/gnu-social
ec145b73fc
Key changes: * Initialization code moved from common.php to StatusNet class; can now switch configurations during runtime. * As a consequence, configuration files must now be idempotent... Be careful with constant, function or class definitions. * Control structure for daemons/QueueManager/QueueHandler has been refactored; the run loop is now managed by IoMaster run via scripts/queuedaemon.php IoManager subclasses are woken to handle socket input or polling, and may cover multiple sites. * Plugins can implement notice queue handlers more easily by registering a QueueHandler class; no more need to add a daemon. The new QueueDaemon runs from scripts/queuedaemon.php: * This replaces most of the old *handler.php scripts; they've been refactored to the bare handler classes. * Spawns multiple child processes to spread load; defaults to CPU count on Linux and Mac OS X systems, or override with --threads=N * When multithreaded, child processes are automatically respawned on failure. * Threads gracefully shut down and restart when passing a soft memory limit (defaults to 90% of memory_limit), limiting damage from memory leaks. * Support for UDP-based monitoring: http://www.gitorious.org/snqmon Rough control flow diagram: QueueDaemon -> IoMaster -> IoManager QueueManager [listen or poll] -> QueueHandler XmppManager [ping & keepalive] XmppConfirmManager [poll updates] Todo: * Respawning features not currently available running single-threaded. * When running single-site, configuration changes aren't picked up. * New sites or config changes affecting queue subscriptions are not yet handled without a daemon restart. * SNMP monitoring output to integrate with general tools (nagios, ganglia) * Convert XMPP confirmation message sends to use stomp queue instead of polling * Convert xmppdaemon.php to IoManager? * Convert Twitter status, friends import polling daemons to IoManager * Clean up some error reporting and failure modes * May need to adjust queue priorities for best perf in backlog/flood cases Detailed code history available in my daemon-work branch: http://www.gitorious.org/~brion/statusnet/brion-fixes/commits/daemon-work |
||
---|---|---|
.. | ||
daemons | ||
locale | ||
README | ||
twitter.php | ||
twitterauthorization.php | ||
twitterbasicauthclient.php | ||
TwitterBridgePlugin.php | ||
twitteroauthclient.php | ||
twitterqueuehandler.php | ||
twittersettings.php |
This Twitter "bridge" plugin allows you to integrate your StatusNet instance with Twitter. Installing it will allow your users to: - automatically post notices to thier Twitter accounts - automatically subscribe to other Twitter users who are also using your StatusNet install, if possible (requires running a daemon) - import their Twitter friends' tweets (requires running a daemon) Installation ------------ To enable the plugin, add the following to your config.php: addPlugin("TwitterBridge"); OAuth is used to to access protected resources on Twitter (as opposed to HTTP Basic Auth)*. To use Twitter bridging you will need to register your instance of StatusNet as an application on Twitter (http://twitter.com/apps), and update the following variables in your config.php with the consumer key and secret Twitter generates for you: $config['twitter']['consumer_key'] = 'YOURKEY'; $config['twitter']['consumer_secret'] = 'YOURSECRET'; When registering your application with Twitter set the type to "Browser" and your Callback URL to: http://example.org/mublog/twitter/authorization The default access type should be, "Read & Write". * Note: The plugin will still push notices to Twitter for users who have previously setup the Twitter bridge using their Twitter name and password under an older versions of StatusNet, but all new Twitter bridge connections will use OAuth. Deamons ------- For friend syncing and importing notices running two additional daemon scripts is necessary (synctwitterfriends.php and twitterstatusfetcher.php). In the daemons subidrectory of the plugin are three scripts: * Twitter Friends Syncing (daemons/synctwitterfriends.php) Users may set a flag in their settings ("Subscribe to my Twitter friends here" under the Twitter tab) to have StatusNet attempt to locate and subscribe to "friends" (people they "follow") on Twitter who also have accounts on your StatusNet system, and who have previously set up a link for automatically posting notices to Twitter. The plugin will try to start this daemon when you run scripts/startdaemons.sh. * Importing statuses from Twitter (daemons/twitterstatusfetcher.php) To allow your users to import their friends' Twitter statuses, you will need to enable the bidirectional Twitter bridge in your config.php: $config['twitterimport']['enabled'] = true; The plugin will then start the TwitterStatusFetcher daemon along with the other daemons when you run scripts/startdaemons.sh. Additionally, you will want to set the integration source variable, which will keep notices posted to Twitter via StatusNet from looping back. The integration source should be set to the name of your application, exactly as you specified it on the settings page for your StatusNet application on Twitter, e.g.: $config['integration']['source'] = 'YourApp'; * TwitterQueueHandler (daemons/twitterqueuehandler.php) This script sends queued notices to Twitter for user who have opted to set up Twitter bridging. It's not strictly necessary to run this queue handler, and sites that haven't enabled queuing are still able to push notices to Twitter, but for larger sites and sites that wish to improve performance, this script allows notices to be sent "offline" via a separate process. The plugin will start this script when you run scripts/startdaemons.sh.