/dev/adei-asec

To get this branch, use:
bzr branch http://darksoft.org/webbzr/dev/adei-asec

« back to all changes in this revision

Viewing changes to system/downloads_clean.php

  • Committer: Suren A. Chilingaryan
  • Date: 2011-03-15 02:47:05 UTC
  • mfrom: (210.1.3 adei)
  • Revision ID: csa@dside.dyndns.org-20110315024705-qljn30gwin8yrkne
Integration of work of students with fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
  
 
3
  if (preg_match("/(.*)downloads_clean.php$/", $_SERVER['SCRIPT_FILENAME'], $m)) @chdir($m[1]);
 
4
  require("../adei.php");
 
5
 
 
6
  global $ADEI;  
 
7
  global $TMP_PATH;
 
8
  global $DOWNLOAD_DECAY_TIME;
 
9
 
 
10
  $ADEI->RequireClass("download");  
 
11
  $dm = new DOWNLOADMANAGER(); 
 
12
  //$dm->Logit("Clearing old downloads\n");
 
13
  $dir = opendir("$TMP_PATH/downloads");
 
14
 
 
15
  while ($file = readdir($dir)) {
 
16
    $fullname = "$TMP_PATH/downloads/$file";    
 
17
    if(time() - fileatime($fullname) > $DOWNLOAD_DECAY_TIME) {  
 
18
      $dotind = strrpos($file, '_');    
 
19
      $download = substr($file, $dotind + 1, 32);
 
20
      $res = $dm->GetDownload($download);
 
21
      $row = mysql_fetch_assoc($res);     
 
22
      if($row["auto_delete"] == "true") $dm->RemoveDownload($download);              
 
23
    }
 
24
  }
 
25
?>
 
 
b'\\ No newline at end of file'