Skip to content

Commit 49a277c

Browse files
authored
Merge pull request #6309 from BOINC/dpa_web26
web: minor fixes
2 parents 8313361 + 31eb5dc commit 49a277c

File tree

5 files changed

+25
-11
lines changed

5 files changed

+25
-11
lines changed

html/inc/cache.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function cache_need_to_regenerate($path, $max_age){
142142
function get_cached_data($max_age, $params=""){
143143
global $no_cache;
144144

145-
if ($no_cache) return;
145+
if ($no_cache) return false;
146146

147147
$path = get_path($params);
148148
if ($max_age) {
Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
11
<?php
22

3-
// Define the lifetime of public php pages.
4-
// define to zero to turn of caching for these pages.
3+
// Some web pages need lots of DB access to generate.
4+
// To reduce DB server load, these pages
5+
// (actually, the data used to create them) can be cached.
6+
// Each type of page has a 'time to live' (TTL) parameter.
7+
// If the age of a cached page exceeds the TTL,
8+
// the page is regenerated.
9+
//
10+
// TTL = 0 means don't cache that type of page
11+
512
define('TEAM_PAGE_TTL', 3600);
613
define('USER_PAGE_TTL', 3600);
7-
define('USER_HOST_TTL', 3600);
814
define('USER_PROFILE_TTL', 3600);
9-
define('TOP_PAGES_TTL', 43200);
15+
define('TOP_PAGES_TTL', 0);
16+
// host/user/team leader boards
17+
// caching these causes inconsistent results
1018
define('INDEX_PAGE_TTL', 3600);
1119
define('STATUS_PAGE_TTL', 3600);
1220
define('REMOTE_PROJECTS_TTL', 86400);
1321

14-
// max allowed cache usage
22+
// max allowed cache usage, bytes
1523
//
16-
define('MAX_CACHE_USAGE', 104857600);
24+
define('MAX_CACHE_USAGE', 1e9);
25+
26+
// the cache can grow without bound,
27+
// so every so often we need to check its size and
28+
// delete old entries.
29+
// We do this randomly, on average every N page views
1730

18-
// Number of page views between cache size checks
1931
define('CACHE_SIZE_CHECK_FREQ', 1000);
2032

2133
?>

html/user/create_team.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
// You should have received a copy of the GNU Lesser General Public License
1717
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
1818

19+
// web RPC for creating teams
20+
1921
// Disabled. being used by spammers,
2022
// and I can't think of a legit use for this.
2123

@@ -42,7 +44,7 @@
4244
xml_error(ERR_DB_NOT_FOUND);
4345
}
4446

45-
if (@constant('TEAM_CREATE_NEED_CREDIT')) {
47+
if (defined('TEAM_CREATE_NEED_CREDIT') && TEAM_CREATE_NEED_CREDIT) {
4648
if ($user->total_credit == 0) {
4749
xml_error(-1, "no credit");
4850
}

html/user/team_create_action.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
$user = get_logged_in_user();
3333

34-
if (@constant('TEAM_CREATE_NEED_CREDIT')) {
34+
if (defined('TEAM_CREATE_NEED_CREDIT') && TEAM_CREATE_NEED_CREDIT) {
3535
if ($user->total_credit == 0) {
3636
error_page("You must complete a task to create a team");
3737
}

html/user/team_create_form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
$user = get_logged_in_user();
2929

30-
if (@constant('TEAM_CREATE_NEED_CREDIT')) {
30+
if (defined('TEAM_CREATE_NEED_CREDIT') && TEAM_CREATE_NEED_CREDIT) {
3131
if ($user->total_credit == 0) {
3232
error_page("You must complete a task to create a team");
3333
}

0 commit comments

Comments
 (0)