3 * StatusNet - a distributed open-source microblogging tool
4 * Copyright (C) 2010, StatusNet, Inc.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
22 $shortoptions = 'i:n:au';
23 $longoptions = array('id=', 'nickname=', 'all', 'universe');
25 $helptext = <<<END_OF_SENDEMAILSUMMARY_HELP
26 sendemailsummary.php [options]
27 Send an email summary of the inbox to users
29 -i --id ID of user to send summary to
30 -n --nickname nickname of the user to send summary to
31 -a --all send summary to all users
32 -u --universe send summary to all users on all sites
34 END_OF_SENDEMAILSUMMARY_HELP;
36 require_once INSTALLDIR.'/scripts/commandline.inc';
38 if (have_option('u', 'universe')) {
39 $sn = new Status_network();
41 while ($sn->fetch()) {
42 $server = $sn->getServerName();
43 GNUsocial::init($server);
44 // Different queue manager, maybe!
45 $qm = QueueManager::get();
46 $qm->enqueue(1, 'sitesum');
50 $qm = QueueManager::get();
51 // enqueue summary for user or all users
54 $qm->enqueue($user->id, 'usersum');
55 } catch (NoUserArgumentException $nuae) {
56 $qm->enqueue(1, 'sitesum');