~ubuntu-branches/ubuntu/lucid/boinc/lucid

« back to all changes in this revision

Viewing changes to html/inc/cache.inc

  • Committer: Bazaar Package Importer
  • Author(s): Frank S. Thomas, Frank S. Thomas
  • Date: 2008-05-31 08:02:47 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20080531080247-4ce890lp2rc768cr
Tags: 6.2.7-1
[ Frank S. Thomas ]
* New upstream release.
  - BOINC Manager: Redraw disk usage charts immediately after connecting to
    a (different) client. (closes: 463823)
* debian/copyright:
  - Added the instructions from debian/README.Debian-source about how
    repackaged BOINC tarballs can be reproduced because DevRef now
    recommends to put this here instead of in the afore-mentioned file.
  - Updated for the new release.
* Removed the obsolete debian/README.Debian-source.
* For consistency upstream renamed the core client and the command tool
  ("boinc_client" to "boinc" and "boinc_cmd" to "boinccmd"). Done the same
  in all packages and created symlinks with the old names for the binaries
  and man pages. Also added an entry in debian/boinc-client.NEWS explaining
  this change.
* debian/rules: Do not list Makefile.ins in the clean target individually,
  just remove all that can be found.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
require_once("../project/cache_parameters.inc");
4
4
 
5
 
if (function_exists("apache_request_headers")) {
6
 
    $no_cache = false;
7
 
    }
8
 
else {
 
5
// If we can't see request headers, don't do caching
 
6
//
 
7
$no_cache = false;
 
8
if (!function_exists("apache_request_headers")) {
9
9
    $no_cache = true;
10
 
    }
 
10
}
11
11
 
12
12
// mechanism for caching commonly-accessed pages
13
13
 
14
14
function make_cache_dirs() {
15
 
    if (!@filemtime("../cache")) mkdir("../cache", 0770);
 
15
    if (!@filemtime("../cache")) {
 
16
        mkdir("../cache", 0770);
 
17
        chmod("../cache", 0770);
 
18
    }
16
19
    for ($i=0;$i<256;$i++) {
17
20
        $j=sprintf("%02x",$i);
18
21
        if (!@filemtime("../cache/$j")) {
19
22
            mkdir("../cache/$j", 0770);
 
23
            chmod("../cache/$j", 0770);
20
24
        } 
21
25
    }
22
26
}
147
151
}
148
152
 
149
153
function start_cache($max_age, $params=""){
150
 
    global $no_cache;
 
154
    global $no_cache, $caching;
 
155
 
151
156
    if ($no_cache) return;
 
157
    $caching = true;
152
158
 
153
159
    $path = get_path($params);
154
160
    $lastmodified = @filemtime($path);
155
161
    cache_check_diskspace(); //Check free disk space once in a while
156
162
 
157
163
    if ($max_age) {
158
 
        $regenerate = cache_need_to_regenerate($path, $max_age); //Is the stored version too old, do we need to regenerate it?
 
164
        //Is the stored version too old, do we need to regenerate it?
 
165
        //
 
166
        $regenerate = cache_need_to_regenerate($path, $max_age);
159
167
        if ($regenerate){
160
168
            // If cached version is too old (or non-existent)
161
169
            // generate the page and write to cache