From: Evan Prodromou Date: Mon, 24 Aug 2009 20:55:49 +0000 (-0400) Subject: Merge branch '0.8.x' into testing X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ff87732053bae38879988ba7d002a294998ccb4e;p=quix0rs-gnu-social.git Merge branch '0.8.x' into testing Conflicts: actions/twitterauthorization.php lib/oauthclient.php lib/twitter.php lib/twitterapi.php lib/twitteroauthclient.php scripts/twitterstatusfetcher.php --- ff87732053bae38879988ba7d002a294998ccb4e diff --cc lib/twitter.php index 2369ac2678,280cdb0a33..11c1374283 --- a/lib/twitter.php +++ b/lib/twitter.php @@@ -450,18 -241,18 +241,78 @@@ function remove_twitter_link($flink if (isset($user->email)) { - $result = mail_twitter_bridge_removed($user); + $result = mail_twitter_bridge_removed($user); + + if (!$result) { + + $msg = 'Unable to send email to notify ' . + "$user->nickname (user id: $user->id) " . + 'that their Twitter bridge link was ' . + 'removed!'; + + common_log(LOG_WARNING, $msg); + } + } + ++} ++ ++ $result = mail_twitter_bridge_removed($user); ++ ++ if (!$result) { ++ ++ $msg = 'Unable to send email to notify ' . ++ "$user->nickname (user id: $user->id) " . ++ 'that their Twitter bridge link was ' . ++ 'removed!'; ++ ++ common_log(LOG_WARNING, $msg); ++ } ++ } ++ ++} ++ ++ $result = mail_twitter_bridge_removed($user); + - if (!$result) { ++ if (!$result) { + - $msg = 'Unable to send email to notify ' . - "$user->nickname (user id: $user->id) " . - 'that their Twitter bridge link was ' . - 'removed!'; ++ $msg = 'Unable to send email to notify ' . ++ "$user->nickname (user id: $user->id) " . ++ 'that their Twitter bridge link was ' . ++ 'removed!'; + - common_log(LOG_WARNING, $msg); ++ common_log(LOG_WARNING, $msg); ++ } + } ++ ++} ++ ++ $result = mail_twitter_bridge_removed($user); ++ ++ if (!$result) { ++ ++ $msg = 'Unable to send email to notify ' . ++ "$user->nickname (user id: $user->id) " . ++ 'that their Twitter bridge link was ' . ++ 'removed!'; ++ ++ common_log(LOG_WARNING, $msg); ++ } ++ } ++ ++} ++ ++ $result = mail_twitter_bridge_removed($user); ++ ++ if (!$result) { ++ ++ $msg = 'Unable to send email to notify ' . ++ "$user->nickname (user id: $user->id) " . ++ 'that their Twitter bridge link was ' . ++ 'removed!'; ++ ++ common_log(LOG_WARNING, $msg); ++ } + } + } diff --cc scripts/twitterstatusfetcher.php index 10aef9ca3e,f5289c5f4b..082bcc9622 --- a/scripts/twitterstatusfetcher.php +++ b/scripts/twitterstatusfetcher.php @@@ -81,126 -87,16 +87,20 @@@ class TwitterStatusFetcher extends Para } /** - * Run the daemon + * Find all the Twitter foreign links for users who have requested + * importing of their friends' timelines * - * @return void + * @return array flinks an array of Foreign_link objects */ - function run() + function getObjects() { - if (defined('SCRIPT_DEBUG')) { - common_debug($this->name() . - ': debugging log output enabled.'); - } - - do { - - $flinks = $this->refreshFlinks(); - - foreach ($flinks as $f) { - - $pid = pcntl_fork(); - - if ($pid == -1) { - die ("Couldn't fork!"); - } - - if ($pid) { - - // Parent - if (defined('SCRIPT_DEBUG')) { - common_debug("Parent: forked new status ". - " fetcher process " . $pid); - } - - $this->_children[] = $pid; - - } else { - - // Child - - // Each child ps needs its own DB connection - - // Note: DataObject::getDatabaseConnection() creates - // a new connection if there isn't one already - - global $_DB_DATAOBJECT; - $conn = &$f->getDatabaseConnection(); - - $this->getTimeline($f); - - $conn->disconnect(); - - // XXX: Couldn't find a less brutal way to blow - // away a cached connection - - unset($_DB_DATAOBJECT['CONNECTIONS']); - - exit(); - } - - // Remove child from ps list as it finishes - while (($c = pcntl_wait($status, WNOHANG OR WUNTRACED)) > 0) { - - if (defined('SCRIPT_DEBUG')) { - common_debug("Child $c finished."); - } - - $this->removePs($this->_children, $c); - } - - // Wait! We have too many damn kids. - if (sizeof($this->_children) > MAXCHILDREN) { - - if (defined('SCRIPT_DEBUG')) { - common_debug('Too many children. Waiting...'); - } - - if (($c = pcntl_wait($status, WUNTRACED)) > 0) { - - if (defined('SCRIPT_DEBUG')) { - common_debug("Finished waiting for $c"); - } - - $this->removePs($this->_children, $c); - } - } - } - - // Remove all children from the process list before restarting - while (($c = pcntl_wait($status, WUNTRACED)) > 0) { - - if (defined('SCRIPT_DEBUG')) { - common_debug("Child $c finished."); - } - - $this->removePs($this->_children, $c); - } - - // Rest for a bit before we fetch more statuses - - if (defined('SCRIPT_DEBUG')) { - common_debug('Waiting ' . POLL_INTERVAL . - ' secs before hitting Twitter again.'); - } - - if (POLL_INTERVAL > 0) { - sleep(POLL_INTERVAL); - } - - } while (true); - } - - /** - * Refresh the foreign links for this user - * - * @return void - */ + global $_DB_DATAOBJECT; - function refreshFlinks() - { ++======= + global $_DB_DATAOBJECT; + ++>>>>>>> 0.8.x:scripts/twitterstatusfetcher.php $flink = new Foreign_link(); $conn = &$flink->getDatabaseConnection();