3
// This file is part of BOINC.
4
// http://boinc.berkeley.edu
5
// Copyright (C) 2008 University of California
7
// BOINC is free software; you can redistribute it and/or modify it
8
// under the terms of the GNU Lesser General Public License
9
// as published by the Free Software Foundation,
10
// either version 3 of the License, or (at your option) any later version.
12
// BOINC is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
// See the GNU Lesser General Public License for more details.
17
// You should have received a copy of the GNU Lesser General Public License
18
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
20
// lock all threads older than N days
23
require_once("../inc/util_ops.inc");
25
$max_age_days = 90; // lock threads older than this
27
if ($argv[1] == "--ndays") {
28
$max_age_days = $argv[2];
32
$t = time_str(time());
33
echo "starting at $t\n";
34
$t = time() - $max_age_days*86400;
36
if (!$db) die("can't open DB\n");
37
$db->do_query("update DBNAME.thread, DBNAME.forum set DBNAME.thread.locked=1 where DBNAME.thread.forum=DBNAME.forum.id and DBNAME.forum.parent_type=0 and DBNAME.thread.timestamp<$t and DBNAME.thread.locked=0 and DBNAME.thread.sticky=0");
38
$n = $db->affected_rows();
39
$t = time_str(time());
40
echo "finished at $t; locked $n threads\n";