/** * Handle problems posting cloud notifications. Increment the failure * count, or delete the subscription if the maximum number of failures * is exceeded. * * XXX: Redo with proper DB_DataObject methods once I figure out what * what the problem is with pluginized DB_DataObjects. -Z * * @param RSSCloudSubscription $cloudSub the subscription in question * * @return boolean success */ function handleFailure($cloudSub) { $failCnt = $cloudSub->failures + 1; if ($failCnt == self::MAX_FAILURES) { common_log(LOG_INFO, 'Deleting RSSCloud subcription ' . '(max failure count reached), profile: ' . $cloudSub->subscribed . ' handler: ' . $cloudSub->url); // XXX: WTF! ->delete() doesn't work. Clearly, there are some issues with // the DB_DataObject, or my understanding of it. Have to drop into SQL. // $result = $cloudSub->delete(); $qry = 'DELETE from rsscloud_subscription' . ' WHERE subscribed = ' . $cloudSub->subscribed . ' AND url = \'' . $cloudSub->url . '\''; $result = $cloudSub->query($qry); if (!$result) { common_log_db_error($cloudSub, 'DELETE', __FILE__); common_log(LOG_ERR, 'Could not delete RSSCloud subscription.'); } } else { common_debug('Updating failure count on RSSCloud subscription. ' . $failCnt); $failCnt = $cloudSub->failures + 1; // XXX: ->update() not working either, gar! $qry = 'UPDATE rsscloud_subscription' . ' SET failures = ' . $failCnt . ' WHERE subscribed = ' . $cloudSub->subscribed . ' AND url = \'' . $cloudSub->url . '\''; $result = $cloudSub->query($qry); if (!$result) { common_log_db_error($cloudsub, 'UPDATE', __FILE__); common_log(LOG_ERR, 'Could not update failure ' . 'count on RSSCloud subscription'); } } }