Make better use of Subscription class

removed lib/subs.php as it was essentially only a wrapper for Subscription
This commit is contained in:
Mikael Nordfeldth
2013-09-19 17:20:44 +02:00
parent a35344eb00
commit 93e878d7ca
10 changed files with 61 additions and 88 deletions

View File

@@ -203,7 +203,7 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon
return false;
}
$user = $flink->getUser();
$profile = $flink->getProfile();
foreach ($friends as $friend) {
@@ -228,20 +228,20 @@ class SyncTwitterFriendsDaemon extends ParallelizingDaemon
// Get associated user and subscribe her
$friend_user = User::getKV('id', $friend_flink->user_id);
$friend_profile = Profile::getKV('id', $friend_flink->user_id);
if (!empty($friend_user)) {
$result = subs_subscribe_to($user, $friend_user);
if ($result === true) {
if ($friend_profile instanceof Profile) {
try {
$other = Profile::getKV('id', $invites->user_id);
Subscription::start($profile, $friend_profile);
common_log(LOG_INFO,
$this->name() . ' - Subscribed ' .
"$friend_user->nickname to $user->nickname.");
} else {
"{$friend_profile->nickname} to {$profile->nickname}.");
} catch (Exception $e) {
common_debug($this->name() .
' - Tried subscribing ' .
"$friend_user->nickname to $user->nickname - " .
$result);
' - Tried and failed subscribing ' .
"{$friend_profile->nickname} to {$profile->nickname} - " .
$e->getMessage());
}
}
}