mirror of https://github.com/BOINC/boinc.git
remote file management: allow long filenames
Originally, the idea for remote file management was that the physical name of a file was its md5, or jf_md5. This was changed to let the submitter choose the name. But in the DB (job_file.md5) we only kept 64 chars. Change the field name to job_file.name, and change it to varchar(255)
This commit is contained in:
parent
39547c574f
commit
3f0f36ac5a
|
@ -349,12 +349,11 @@ create table user_submit_app (
|
|||
primary key (user_id, app_id)
|
||||
) engine = InnoDB;
|
||||
|
||||
-- Record files present on server.
|
||||
-- Files are named jf_(md5)
|
||||
-- Record files (created by remote file mgt) present on server.
|
||||
--
|
||||
create table job_file (
|
||||
id integer not null auto_increment,
|
||||
md5 char(64) not null,
|
||||
name varchar(255) not null,
|
||||
create_time double not null,
|
||||
delete_time double not null,
|
||||
primary key (id)
|
||||
|
|
|
@ -115,9 +115,9 @@ class BoincJobFile {
|
|||
if (!$ret) return false;
|
||||
return $db->insert_id();
|
||||
}
|
||||
static function lookup_md5($md5) {
|
||||
static function lookup_name($name) {
|
||||
$db = BoincDb::get();
|
||||
return $db->lookup('job_file', 'BoincJobFile', "md5='$md5'");
|
||||
return $db->lookup('job_file', 'BoincJobFile', "name='$name'");
|
||||
}
|
||||
function delete() {
|
||||
$db = BoincDb::get();
|
||||
|
|
|
@ -1027,6 +1027,10 @@ function update_1_27_2016() {
|
|||
do_query("alter table team add column mod_time timestamp default current_timestamp on update current_timestamp");
|
||||
}
|
||||
|
||||
function update_2_17_2017() {
|
||||
do_query("alter table job_file change md5 name varchar(255) not null");
|
||||
}
|
||||
|
||||
// Updates are done automatically if you use "upgrade".
|
||||
//
|
||||
// If you need to do updates manually,
|
||||
|
@ -1073,6 +1077,7 @@ $db_updates = array (
|
|||
array(27012, "update_10_8_2014"),
|
||||
array(27013, "update_4_15_2015"),
|
||||
array(27014, "update_1_27_2016"),
|
||||
array(27015, "update_2_17_2017"),
|
||||
);
|
||||
|
||||
?>
|
||||
|
|
|
@ -117,7 +117,7 @@ function query_files($r) {
|
|||
// update the delete time first to avoid race condition
|
||||
// with job file deleter
|
||||
//
|
||||
$job_file = BoincJobFile::lookup_md5($fname);
|
||||
$job_file = BoincJobFile::lookup_name($fname);
|
||||
if ($job_file && $job_file->delete_time < $delete_time) {
|
||||
$retval = $job_file->update("delete_time=$delete_time");
|
||||
if ($retval) {
|
||||
|
@ -131,10 +131,10 @@ function query_files($r) {
|
|||
$jf_id = $job_file->id;
|
||||
} else {
|
||||
$jf_id = BoincJobFile::insert(
|
||||
"(md5, create_time, delete_time) values ('$fname', $now, $delete_time)"
|
||||
"(name, create_time, delete_time) values ('$fname', $now, $delete_time)"
|
||||
);
|
||||
if (!$jf_id) {
|
||||
xml_error(-1, "query_file(): BoincJobFile::insert($fname) failed: ".BoincDb::error());
|
||||
xml_error(-1, "query_files(): BoincJobFile::insert($fname) failed: ".BoincDb::error());
|
||||
}
|
||||
}
|
||||
// create batch association if needed
|
||||
|
@ -233,7 +233,7 @@ function upload_files($r) {
|
|||
}
|
||||
|
||||
$jf_id = BoincJobFile::insert(
|
||||
"(md5, create_time, delete_time) values ('$fname', $now, $delete_time)"
|
||||
"(name, create_time, delete_time) values ('$fname', $now, $delete_time)"
|
||||
);
|
||||
if (!$jf_id) {
|
||||
xml_error(-1, "BoincJobFile::insert($fname) failed: ".BoincDb::error());
|
||||
|
|
Loading…
Reference in New Issue