mirror of https://github.com/BOINC/boinc.git
- web: add global prefs reset button
- change default disk prefs to: - no absolute limit on disk usage (we need to work with future disks) - keep 100 MB min free space - use up to 90% of total space svn path=/trunk/boinc/; revision=26141
This commit is contained in:
parent
925f029556
commit
7d3bc3e3cf
|
@ -6047,3 +6047,19 @@ David 22 Sept 2012
|
|||
cs_statefile.cpp
|
||||
script/
|
||||
boinc-client.in
|
||||
|
||||
David 23 Sept 2012
|
||||
- web: add global prefs reset button
|
||||
- change default disk prefs to:
|
||||
- no absolute limit on disk usage (we need to work with future disks)
|
||||
- keep 100 MB min free space
|
||||
- use up to 90% of total space
|
||||
|
||||
html/
|
||||
user/
|
||||
prefs_default.php (new)
|
||||
prefs.php
|
||||
inc/
|
||||
prefs.inc
|
||||
lib/
|
||||
prefs.cpp
|
||||
|
|
|
@ -408,9 +408,9 @@ function get_disk_space_config() {
|
|||
$dp->disk_max_used_pct = parse_config($config, "<default_disk_max_used_pct>");
|
||||
$dp->disk_min_free_gb = parse_config($config, "<default_disk_min_free_gb>");
|
||||
// set some defaults if not found
|
||||
if (!$dp->disk_max_used_gb) $dp->disk_max_used_gb = 100; // 100 gb
|
||||
if (!$dp->disk_max_used_pct) $dp->disk_max_used_pct = 50; // 50 percent
|
||||
if (!$dp->disk_min_free_gb) $dp->disk_min_free_gb=.001; // 1 megabyte
|
||||
if (!$dp->disk_max_used_gb) $dp->disk_max_used_gb = 0; // no limit
|
||||
if (!$dp->disk_max_used_pct) $dp->disk_max_used_pct = 90; // 90 percent
|
||||
if (!$dp->disk_min_free_gb) $dp->disk_min_free_gb=.1; // 100 MB
|
||||
// set mininimum free space scheduler allows
|
||||
// - depends on which scheduler is running
|
||||
$dp->new_sched_flag = 1;
|
||||
|
@ -584,7 +584,7 @@ function default_prefs_project() {
|
|||
global $project_pref_descs;
|
||||
|
||||
$p = null;
|
||||
foreach($project_pref_descs as $pref) {
|
||||
foreach ($project_pref_descs as $pref) {
|
||||
$pref->set_default($p);
|
||||
}
|
||||
$p->project_specific = project_specific_prefs_default();
|
||||
|
@ -814,7 +814,10 @@ function prefs_display_venue($prefs, $venue, $subset) {
|
|||
prefs_show_project($x);
|
||||
prefs_show_project_specific($x);
|
||||
}
|
||||
row2("<br>", "<a href=prefs_edit.php?venue=$venue&subset=$subset$tokens>".tra("Edit preferences")."</a> | <a href=prefs_remove.php?venue=$venue&subset=$subset$tokens>".tra("Remove")."</a>");
|
||||
row2("<br>",
|
||||
"<a href=prefs_edit.php?venue=$venue&subset=$subset$tokens>".tra("Edit preferences")."</a>
|
||||
| <a href=prefs_remove.php?venue=$venue&subset=$subset$tokens>".tra("Remove")."</a>
|
||||
");
|
||||
end_table();
|
||||
echo "</td></tr>\n";
|
||||
} else {
|
||||
|
@ -889,7 +892,9 @@ function print_prefs_display_global($user, $columns=false) {
|
|||
start_table();
|
||||
prefs_show_global($global_prefs);
|
||||
$tokens = url_tokens($user->authenticator);
|
||||
row2("<br>", "<a href=prefs_edit.php?subset=global$tokens>".tra("Edit preferences")."</a>");
|
||||
row2("<br>",
|
||||
"<a href=prefs_edit.php?subset=global$tokens>".tra("Edit preferences")."</a>
|
||||
");
|
||||
end_table();
|
||||
echo "</td></tr>\n";
|
||||
|
||||
|
@ -1170,12 +1175,10 @@ function global_prefs_update(&$user, $prefs) {
|
|||
$query = "update user set global_prefs='$prefs_xml' where id=$user->id";
|
||||
$retval = mysql_query($query);
|
||||
if (!$retval) {
|
||||
echo tra("Update failed: ").htmlspecialchars($query)."\n";
|
||||
echo mysql_error();
|
||||
exit();
|
||||
return 1;
|
||||
}
|
||||
$user->global_prefs = $prefs_xml;
|
||||
return $retval;
|
||||
return 0;
|
||||
}
|
||||
|
||||
function project_prefs_update(&$user, $prefs) {
|
||||
|
@ -1184,8 +1187,11 @@ function project_prefs_update(&$user, $prefs) {
|
|||
$show_hosts = $user->show_hosts?1:0;
|
||||
$query = "update user set project_prefs='$prefs_xml', send_email=$send_email, show_hosts=$show_hosts where id=$user->id";
|
||||
$retval = mysql_query($query);
|
||||
if (!$retval) {
|
||||
return 1;
|
||||
}
|
||||
$user->project_prefs = $prefs_xml;
|
||||
return $retval;
|
||||
return 0;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -20,8 +20,6 @@ require_once("../inc/db.inc");
|
|||
require_once("../inc/util.inc");
|
||||
require_once("../inc/prefs.inc");
|
||||
|
||||
check_get_args(array("subset", "cols", "updated"));
|
||||
|
||||
db_init();
|
||||
|
||||
$user = get_logged_in_user();
|
||||
|
@ -29,6 +27,7 @@ $user = get_logged_in_user();
|
|||
$subset = get_str("subset");
|
||||
$columns = get_int("cols", true);
|
||||
$updated = get_int("updated", true);
|
||||
$defaults = get_int("defaults", true);
|
||||
|
||||
page_head(tra("%1 preferences", subset_name($subset)));
|
||||
if (isset($updated)) {
|
||||
|
@ -40,11 +39,28 @@ if (isset($updated)) {
|
|||
</p>
|
||||
";
|
||||
}
|
||||
if (isset($defaults)) {
|
||||
echo "<p style='color: red'>
|
||||
".tra("Your preferences have been reset to the defaults, and
|
||||
will take effect when your computer communicates with %1
|
||||
or you issue the %2Update%3 command from the BOINC Manager.",
|
||||
PROJECT, "<strong>", "</strong>")."
|
||||
</p>
|
||||
";
|
||||
}
|
||||
if ($subset == "global") {
|
||||
print_prefs_display_global($user, $columns);
|
||||
if (!$defaults) {
|
||||
show_button(
|
||||
"prefs_default.php",
|
||||
"Restore defaults",
|
||||
"Restore default preferences"
|
||||
);
|
||||
}
|
||||
} else {
|
||||
print_prefs_display_project($user, $columns);
|
||||
}
|
||||
|
||||
page_tail();
|
||||
|
||||
$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
// This file is part of BOINC.
|
||||
// http://boinc.berkeley.edu
|
||||
// Copyright (C) 2012 University of California
|
||||
//
|
||||
// BOINC is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// BOINC is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
// See the GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// reset user's preferences to the defaults
|
||||
|
||||
require_once("../inc/util.inc");
|
||||
require_once("../inc/prefs.inc");
|
||||
|
||||
$confirmed = get_int("confirmed", true);
|
||||
$user = get_logged_in_user();
|
||||
|
||||
if (!$confirmed) {
|
||||
page_head("Confirm reset preferences");
|
||||
echo "
|
||||
You have requested restoring your computing preferences
|
||||
to the default settings.
|
||||
Your current preferences will be discarded.
|
||||
Do you really want to do this?
|
||||
<br>
|
||||
";
|
||||
show_button("prefs_default.php?confirmed=1", "Yes", "Restore default preferences");
|
||||
show_button("prefs.php", "No", "Keep current preferences");
|
||||
page_tail();
|
||||
} else {
|
||||
$prefs = default_prefs_global();
|
||||
$retval = global_prefs_update($user, $prefs);
|
||||
if ($retval) {
|
||||
error_page("Couldn't restore default preferences.");
|
||||
} else {
|
||||
Header("Location: prefs.php?subset=global&defaults=1$c");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -225,8 +225,8 @@ void GLOBAL_PREFS::defaults() {
|
|||
max_ncpus = 0;
|
||||
cpu_scheduling_period_minutes = 60;
|
||||
disk_interval = 60;
|
||||
disk_max_used_gb = 10;
|
||||
disk_max_used_pct = 50;
|
||||
disk_max_used_gb = 0;
|
||||
disk_max_used_pct = 90;
|
||||
disk_min_free_gb = 0.1;
|
||||
vm_max_used_frac = 0.75;
|
||||
ram_max_used_busy_frac = 0.5;
|
||||
|
|
Loading…
Reference in New Issue