Make queuing and daemons work via events
This commit is contained in:
parent
39bcd514b4
commit
0fd8e758ad
@ -81,7 +81,7 @@ class Avatar extends Memcached_DataObject
|
||||
if (empty($server)) {
|
||||
$server = common_config('site', 'server');
|
||||
}
|
||||
|
||||
common_debug('path = ' . $path);
|
||||
// XXX: protocol
|
||||
|
||||
return 'http://'.$server.$path.$filename;
|
||||
|
@ -97,5 +97,22 @@ class TwitterBridgePlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
function onStartEnqueueNotice($notice, $transports)
|
||||
{
|
||||
array_push($transports, 'twitter');
|
||||
return true;
|
||||
}
|
||||
|
||||
function onGetValidDaemons($daemons)
|
||||
{
|
||||
array_push($daemons, INSTALLDIR . '/plugins/TwitterBridge/daemons/twitterqueuehandler.php');
|
||||
array_push($daemons, INSTALLDIR . '/plugins/TwitterBridge/daemons/synctwitterfriends.php');
|
||||
|
||||
if (common_config('twitterbridge', 'enabled')) {
|
||||
array_push($daemons, INSTALLDIR . '/plugins/TwitterBridge/daemons/twitterstatusfetcher.php');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -33,6 +33,8 @@ END_OF_TRIM_HELP;
|
||||
require_once INSTALLDIR . '/scripts/commandline.inc';
|
||||
require_once INSTALLDIR . '/lib/parallelizingdaemon.php';
|
||||
require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php';
|
||||
require_once INSTALLDIR . '/plugins/TwitterBridge/twitterbasicauthclient.php';
|
||||
require_once INSTALLDIR . '/plugins/TwitterBridge/twitteroauthclient.php';
|
||||
|
||||
/**
|
||||
* Daemon to sync local friends with Twitter friends
|
||||
@ -45,14 +47,6 @@ require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php';
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
$helptext = <<<END_OF_TWITTER_HELP
|
||||
Batch script for synching local friends with Twitter friends.
|
||||
|
||||
END_OF_TWITTER_HELP;
|
||||
|
||||
require_once INSTALLDIR . '/scripts/commandline.inc';
|
||||
require_once INSTALLDIR . '/lib/parallelizingdaemon.php';
|
||||
|
||||
class SyncTwitterFriendsDaemon extends ParallelizingDaemon
|
||||
{
|
||||
/**
|
||||
|
@ -37,8 +37,11 @@ Batch script for retrieving Twitter messages from foreign service.
|
||||
END_OF_TRIM_HELP;
|
||||
|
||||
require_once INSTALLDIR . '/scripts/commandline.inc';
|
||||
require_once INSTALLDIR . '/lib/common.php';
|
||||
require_once INSTALLDIR . '/lib/daemon.php';
|
||||
require_once INSTALLDIR . '/plugins/TwitterBridge/twitter.php';
|
||||
require_once INSTALLDIR . '/plugins/TwitterBridge/twitterbasicauthclient.php';
|
||||
require_once INSTALLDIR . '/plugins/TwitterBridge/twitteroauthclient.php';
|
||||
|
||||
/**
|
||||
* Fetcher for statuses from Twitter
|
||||
@ -497,8 +500,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
|
||||
$avatar->filename = $filename;
|
||||
$avatar->url = Avatar::url($filename);
|
||||
|
||||
common_debug($this->name() . " - New filename: $avatar->url");
|
||||
|
||||
$avatar->created = common_sql_now();
|
||||
|
||||
$id = $avatar->insert();
|
||||
@ -516,9 +517,7 @@ class TwitterStatusFetcher extends ParallelizingDaemon
|
||||
|
||||
function fetchAvatar($url, $filename)
|
||||
{
|
||||
$avatar_dir = INSTALLDIR . '/avatar/';
|
||||
|
||||
$avatarfile = $avatar_dir . $filename;
|
||||
$avatarfile = Avatar::path($filename);
|
||||
|
||||
$out = fopen($avatarfile, 'wb');
|
||||
if (!$out) {
|
||||
|
@ -23,6 +23,9 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
|
||||
define('TWITTER_SERVICE', 1); // Twitter is foreign_service ID 1
|
||||
|
||||
require_once INSTALLDIR . '/plugins/TwitterBridge/twitterbasicauthclient.php';
|
||||
require_once INSTALLDIR . '/plugins/TwitterBridge/twitteroauthclient.php';
|
||||
|
||||
function updateTwitter_user($twitter_id, $screen_name)
|
||||
{
|
||||
$uri = 'http://twitter.com/' . $screen_name;
|
||||
|
@ -49,15 +49,6 @@ if(common_config('xmpp','enabled')) {
|
||||
$daemons[] = INSTALLDIR.'/scripts/xmppconfirmhandler.php';
|
||||
}
|
||||
|
||||
if(common_config('twitterbridge','enabled')) {
|
||||
$daemons[] = INSTALLDIR.'/scripts/twitterstatusfetcher.php';
|
||||
}
|
||||
|
||||
if (common_config('twitter', 'enabled')) {
|
||||
$daemons[] = INSTALLDIR.'/scripts/twitterqueuehandler.php';
|
||||
$daemons[] = INSTALLDIR.'/scripts/synctwitterfriends.php';
|
||||
}
|
||||
|
||||
if (common_config('sms', 'enabled')) {
|
||||
$daemons[] = INSTALLDIR.'/scripts/smsqueuehandler.php';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user