#65 Deleting Tmp files does not work !!!

closed
nobody
None
5
2010-02-18
2009-03-25
Anonymous
No

Deleting tmp files with avantfaxcron.php script doesn't work with german version of php because of wrong file stat:

$dayfile = date ("d", $stat[8]); // file size in bytes

should be:

$dayfile = date ("d", $stat[9]); // last file access time

maybe its possible to rewrite this code for multilanguage use!?! also only the day is considered, not the month!?!

Discussion

  • Nobody/Anonymous

    maybe:

    // remove old temporary files
    foreach (scandir ($TMPDIR) as $file) {
    if ($file != '..' && $file != '.' && $file != 'index.html') {
    $stat = stat ($TMPDIR.$file);
    $today = date ("U");
    $timefile = $stat[10];
    $tmpsecs = $tmpdays * 3600;

    if (($today - $timefile) >= $tmpsecs) {
    echo "Deleting: ".$TMPDIR.$file."\n";
    deltree ($TMPDIR.$file);
    }
    }
    }

     
  • Nobody/Anonymous

    (using timestamps)

     
  • Dave

    Dave - 2009-05-19

    $today = time();

    // remove old temporary files
    foreach (scandir($TMPDIR) as $file) {
    if ($file != '..' && $file != '.' && $file != 'index.html') {
    if ($stat = stat($TMPDIR.$file)) {
    $dayfile = $stat[8];
    $diff = round(($today - $dayfile) / 60 / 60 / 24);

    if ($diff >= $tmpdays) {
    deltree($TMPDIR.$file);
    }
    } else {
    echo "Stat error: $TMPDIR.$file\n";
    }
    }
    }

     
  • Dave

    Dave - 2010-02-18

    This should be fixed in the next release.

     
  • Dave

    Dave - 2010-02-18
    • status: open --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks