. * * @category Sample * @package StatusNet * @author Evan Prodromou * @copyright 2010 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ if (!defined('STATUSNET')) { exit(1); } /** * * Handler for queue items of type 'sitesum', sends email summaries * to all users on the site. * * @category Email * @package StatusNet * @author Evan Prodromou * @copyright 2010 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ class SiteEmailSummaryHandler extends QueueHandler { /** * Return transport keyword which identifies items this queue handler * services; must be defined for all subclasses. * * Must be 8 characters or less to fit in the queue_item database. * ex "email", "jabber", "sms", "irc", ... * * @return string */ function transport() { return 'sitesum'; } /** * Handle the site * * @param mixed $object * @return boolean true on success, false on failure */ function handle($object) { $qm = QueueManager::get(); try { // Enqueue a summary for all users $user = new User(); $user->find(); while ($user->fetch()) { try { $qm->enqueue($user->id, 'usersum'); } catch (Exception $e) { common_log(LOG_WARNING, $e->getMessage()); continue; } } } catch (Exception $e) { common_log(LOG_WARNING, $e->getMessage()); } return true; } }