summaryrefslogtreecommitdiff
path: root/plugins/TwitterBridge/daemons/twitterstatusfetcher.php
diff options
context:
space:
mode:
authorSiebrand Mazeland <s.mazeland@xs4all.nl>2010-09-18 17:45:18 +0200
committerSiebrand Mazeland <s.mazeland@xs4all.nl>2010-09-18 17:45:18 +0200
commitba6538ed78df3049fa59aed0855b0e3af54c994f (patch)
tree2356af3ac54f6f46ab77cc2e79562f7be9bc97fa /plugins/TwitterBridge/daemons/twitterstatusfetcher.php
parent1c5e00df3035b2f0280ad98d028742adef2b09c4 (diff)
* i18n/L10n updates
* whitespace updates.
Diffstat (limited to 'plugins/TwitterBridge/daemons/twitterstatusfetcher.php')
-rwxr-xr-xplugins/TwitterBridge/daemons/twitterstatusfetcher.php24
1 files changed, 1 insertions, 23 deletions
diff --git a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php
index f1305696b..31129b96d 100755
--- a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php
+++ b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php
@@ -62,7 +62,6 @@ require_once INSTALLDIR . '/plugins/TwitterBridge/twitteroauthclient.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class TwitterStatusFetcher extends ParallelizingDaemon
{
/**
@@ -87,7 +86,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
*
* @return string Name of the daemon.
*/
-
function name()
{
return ('twitterstatusfetcher.'.$this->_id);
@@ -99,7 +97,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
*
* @return array flinks an array of Foreign_link objects
*/
-
function getObjects()
{
global $_DB_DATAOBJECT;
@@ -133,12 +130,10 @@ class TwitterStatusFetcher extends ParallelizingDaemon
}
function childTask($flink) {
-
// Each child ps needs its own DB connection
// Note: DataObject::getDatabaseConnection() creates
// a new connection if there isn't one already
-
$conn = &$flink->getDatabaseConnection();
$this->getTimeline($flink);
@@ -150,7 +145,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
// XXX: Couldn't find a less brutal way to blow
// away a cached connection
-
global $_DB_DATAOBJECT;
unset($_DB_DATAOBJECT['CONNECTIONS']);
}
@@ -201,9 +195,7 @@ class TwitterStatusFetcher extends ParallelizingDaemon
// Reverse to preserve order
foreach (array_reverse($timeline) as $status) {
-
// Hacktastic: filter out stuff coming from this StatusNet
-
$source = mb_strtolower(common_config('integration', 'source'));
if (preg_match("/$source/", mb_strtolower($status->source))) {
@@ -214,7 +206,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
// Don't save it if the user is protected
// FIXME: save it but treat it as private
-
if ($status->user->protected) {
continue;
}
@@ -232,7 +223,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
}
// Okay, record the time we synced with Twitter for posterity
-
$flink->last_noticesync = common_sql_now();
$flink->update();
}
@@ -250,7 +240,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
$statusUri = $this->makeStatusURI($status->user->screen_name, $status->id);
// check to see if we've already imported the status
-
$n2s = Notice_to_status::staticGet('status_id', $status->id);
if (!empty($n2s)) {
@@ -263,7 +252,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
}
// If it's a retweet, save it as a repeat!
-
if (!empty($status->retweeted_status)) {
common_log(LOG_INFO, "Status {$status->id} is a retweet of {$status->retweeted_status->id}.");
$original = $this->saveStatus($status->retweeted_status);
@@ -273,7 +261,7 @@ class TwitterStatusFetcher extends ParallelizingDaemon
$author = $original->getProfile();
// TRANS: Message used to repeat a notice. RT is the abbreviation of 'retweet'.
// TRANS: %1$s is the repeated user's name, %2$s is the repeated notice.
- $content = sprintf(_('RT @%1$s %2$s'),
+ $content = sprintf(_m('RT @%1$s %2$s'),
$author->nickname,
$original->content);
@@ -365,7 +353,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
*
* @return string URI
*/
-
function makeStatusURI($username, $id)
{
return 'http://twitter.com/'
@@ -383,7 +370,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
*
* @return mixed value the first Profile with that url, or null
*/
-
function getProfileByUrl($nickname, $profileurl)
{
$profile = new Profile();
@@ -407,7 +393,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
*
* @return mixed value a matching Notice or null
*/
-
function checkDupe($profile, $statusUri)
{
$notice = new Notice();
@@ -426,7 +411,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
function ensureProfile($user)
{
// check to see if there's already a profile for this user
-
$profileurl = 'http://twitter.com/' . $user->screen_name;
$profile = $this->getProfileByUrl($user->screen_name, $profileurl);
@@ -440,7 +424,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
return $profile;
} else {
-
common_debug($this->name() . ' - Adding profile and remote profile ' .
"for Twitter user: $profileurl.");
@@ -472,7 +455,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
$remote_pro = Remote_profile::staticGet('uri', $profileurl);
if (empty($remote_pro)) {
-
$remote_pro = new Remote_profile();
$remote_pro->id = $id;
@@ -619,7 +601,6 @@ class TwitterStatusFetcher extends ParallelizingDaemon
$avatar = $profile->getAvatar($sizes[$size]);
// Delete the avatar, if present
-
if ($avatar) {
$avatar->delete();
}
@@ -644,10 +625,8 @@ class TwitterStatusFetcher extends ParallelizingDaemon
$avatar->height = 48;
break;
default:
-
// Note: Twitter's big avatars are a different size than
// StatusNet's (StatusNet's = 96)
-
$avatar->width = 73;
$avatar->height = 73;
}
@@ -822,4 +801,3 @@ if (have_option('d') || have_option('debug')) {
$fetcher = new TwitterStatusFetcher($id, 60, 2, $debug);
$fetcher->runOnce();
-