~ubuntu-branches/ubuntu/precise/boinc/precise

« back to all changes in this revision

Viewing changes to html/ops/repair_profile_pictures.php

Tags: 6.12.8+dfsg-1
* New upstream release.
* Simplified debian/rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
// This file is part of BOINC.
 
3
// http://boinc.berkeley.edu
 
4
// Copyright (C) 2008 University of California
 
5
//
 
6
// BOINC is free software; you can redistribute it and/or modify it
 
7
// under the terms of the GNU Lesser General Public License
 
8
// as published by the Free Software Foundation,
 
9
// either version 3 of the License, or (at your option) any later version.
 
10
//
 
11
// BOINC 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.
 
14
// See the GNU Lesser General Public License for more details.
 
15
//
 
16
// You should have received a copy of the GNU Lesser General Public License
 
17
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
 
18
 
 
19
// script to repair the "has_picture" field of profiles
 
20
 
 
21
ini_set("memory_limit", "1023M");
 
22
 
 
23
$cli_only = true;
 
24
require_once("../inc/util_ops.inc");
 
25
 
 
26
BoincDb::get();
 
27
 
 
28
$profiles = BoincProfile::enum("");
 
29
 
 
30
foreach ($profiles as $p) {
 
31
    $id = $p->userid;
 
32
    $path = "../user_profile/images/$id.jpg";
 
33
    $smpath = "../user_profile/images/".$id."_sm.jpg";
 
34
    $has_pic = file_exists($path);
 
35
    $has_pic_sm = file_exists($smpath);
 
36
    if ($p->has_picture) {
 
37
        if (!$has_pic || !$has_pic_sm) {
 
38
            echo "$id $p->has_picture $has_pic $has_pic_sm\n";
 
39
            BoincProfile::update_aux("has_picture=0 where userid=$id");
 
40
        }
 
41
    } else {
 
42
        if ($has_pic && $has_pic_sm) {
 
43
            echo "$id $p->has_picture $has_pic $has_pic_sm\n";
 
44
            BoincProfile::update_aux("has_picture=1 where userid=$id");
 
45
        }
 
46
    }
 
47
}
 
48
 
 
49
?>