4 * StatusNet - a distributed open-source microblogging tool
5 * Copyright (C) 2011, StatusNet, Inc.
7 * Script to print out current version of the software
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Affero General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Affero General Public License for more details.
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 define('INSTALLDIR', realpath(dirname(__FILE__) . '/../..'));
26 $longoptions = array('universe');
28 $helptext = <<<END_OF_CLEANUPCHANNELS_HELP
29 cleanupchannels.php [options]
30 Garbage-collects old realtime channels
32 -u --universe Do all sites
34 END_OF_CLEANUPCHANNELS_HELP;
36 require_once INSTALLDIR.'/scripts/commandline.inc.php';
38 function cleanupChannels()
40 $rc = new Realtime_channel();
43 $rc->selectAdd('channel_key');
45 $rc->whereAdd('modified < "' . common_sql_date(time() - Realtime_channel::TIMEOUT) . '"');
48 $keys = $rc->fetchAll();
50 foreach ($keys as $key) {
51 $rc = Realtime_channel::getKV('channel_key', $key);
53 printfv("Deleting realtime channel '$key'\n");
60 if (have_option('u', 'universe')) {
61 $sn = new Status_network();
63 while ($sn->fetch()) {
64 $server = $sn->getServerName();
65 GNUsocial::init($server);