issue #0001908 : Wait more time to download file

This commit is contained in:
Michael RICOIS 2014-03-24 13:54:14 +00:00
parent 9b7f290ee6
commit dc36edbf8f
3 changed files with 14 additions and 12 deletions

View File

@ -25,7 +25,7 @@ class TelechargementController extends Zend_Controller_Action
if (!is_dir($this->path)) mkdir($this->path);
// Recuperation du nom du fichier
if ($filename===null) {
if ( $filename === null ) {
$tableau = explode('/', $url);
$file = $tableau[sizeof($tableau) - 1];
} else {
@ -33,14 +33,16 @@ class TelechargementController extends Zend_Controller_Action
}
// Suppression du fichier si le temps de cache est depasse
if (file_exists($this->path.'/'.$file)){
$dateFile = filemtime($this->path.'/'.$file);
$now = mktime(date('G'), date('i'), date('s'),
date('m') , date('d'), date('Y'));
$maxTime = mktime(date('G',$dateFile)+$this->filetime, date('i',$dateFile),
date('s',$dateFile), date('m',$dateFile),
date('d',$dateFile), date('Y',$dateFile));
if ($maxTime-$now<0) {
if ( $this->filetime == 0 && file_exists($this->path.'/'.$file) ){
unlink($this->path.'/'.$file);
} elseif ( file_exists($this->path.'/'.$file) ) {
$dateFile = filemtime($this->path.'/'.$file);
$now = mktime(date('G'), date('i'), date('s'),
date('m') , date('d'), date('Y'));
$maxTime = mktime(date('G',$dateFile)+$this->filetime, date('i',$dateFile),
date('s',$dateFile), date('m',$dateFile),
date('d',$dateFile), date('Y',$dateFile));
if ( $maxTime - $now < 0 ) {
unlink($this->path.'/'.$file);
}
}
@ -82,7 +84,7 @@ class TelechargementController extends Zend_Controller_Action
*/
public function consommationAction()
{
$this->filetime = 1;
$this->filetime = 0;
$request = $this->getRequest();
$start = $request->getParam('start', false);

View File

@ -19,7 +19,7 @@ $(document).ready(function(){
ConsoDetails = $('input[name=ConsoDetails]').prop('checked') ? 1 : 0;
ConsoMois = $('select[name=ConsoMois]').val();
checkFile();
holdTheInterval = setInterval(checkFile, 4000);
holdTheInterval = setInterval(checkFile, 8000);
});
function checkFile() {

View File

@ -11,7 +11,7 @@ $(document).ready(function(){
postUrl = $(this).attr('href');
source = $('select[name=source]').val();
checkFile();
holdTheInterval = setInterval(checkFile, 4000);
holdTheInterval = setInterval(checkFile, 5000);
});
function checkFile() {