Merge branch 'feature.content-md5' into develop
This commit is contained in:
commit
05a9697007
@ -150,7 +150,7 @@ class IDF_Upload extends Pluf_Model
|
|||||||
if ($this->id == '') {
|
if ($this->id == '') {
|
||||||
$this->creation_dtime = gmdate('Y-m-d H:i:s');
|
$this->creation_dtime = gmdate('Y-m-d H:i:s');
|
||||||
$this->modif_dtime = gmdate('Y-m-d H:i:s');
|
$this->modif_dtime = gmdate('Y-m-d H:i:s');
|
||||||
$this->md5 = md5_file (Pluf::f('upload_path') . '/' . $this->get_project()->shortname . '/files/' . $this->file);
|
$this->md5 = md5_file ($this->getFullPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,6 +167,11 @@ class IDF_Upload extends Pluf_Model
|
|||||||
return Pluf::f('url_upload').'/'.$project->shortname.'/files/'.$this->file;
|
return Pluf::f('url_upload').'/'.$project->shortname.'/files/'.$this->file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getFullPath()
|
||||||
|
{
|
||||||
|
return(Pluf::f('upload_path').'/'.$this->get_project()->shortname.'/files/'.$this->file);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We drop the information from the timeline.
|
* We drop the information from the timeline.
|
||||||
*/
|
*/
|
||||||
@ -256,4 +261,4 @@ class IDF_Upload extends Pluf_Model
|
|||||||
}
|
}
|
||||||
Pluf_Translation::loadSetLocale($current_locale);
|
Pluf_Translation::loadSetLocale($current_locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,11 @@ class IDF_Views_Download
|
|||||||
$prj->inOr404($upload);
|
$prj->inOr404($upload);
|
||||||
$upload->downloads += 1;
|
$upload->downloads += 1;
|
||||||
$upload->update();
|
$upload->update();
|
||||||
return new Pluf_HTTP_Response_Redirect($upload->getAbsoluteUrl($prj));
|
$path = $upload->getFullPath();
|
||||||
|
$mime = IDF_FileUtil::getMimeType($path);
|
||||||
|
$render = new Pluf_HTTP_Response_File($path, $mime[0]);
|
||||||
|
$render->headers["Content-MD5"] = $upload->md5;
|
||||||
|
return $render;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user