Ich habe im Cache noch ein Unterverzeichniss das nicht gelöscht werden soll ich habe das php Script jetzt mal bekomme aber noch Fehler ich möchte gerne alle 24 Stunden
die gecachten Sql queries löschen die sehen so aus : sql_13249c5274f8d83417e7573223200581a.php
der Fehler ist jetzt :
Warning: opendir(/cache/) [function.opendir]: failed to open dir: No such file or directory in /pages/39/86/d0006025/home/htdocs/testforum/del/del.php on line 12
Warning: readdir(): supplied argument is not a valid Directory resource in /pages/39/86/d0006025/home/htdocs/testforum/del/del.php on line 14
Warning: closedir(): supplied argument is not a valid Directory resource in /pages/39/86/d0006025/home/htdocs/testforum/del/del.php on line 22
Warning: fopen(/del/delcache.log) [function.fopen]: failed to open stream: No such file or directory in /pages/39/86/d0006025/home/htdocs/testforum/del/del.php on line 24
Warning: fwrite(): supplied argument is not a valid stream resource in /pages/39/86/d0006025/home/htdocs/testforum/del/del.php on line 29
Warning: fclose(): supplied argument is not a valid stream resource in /pages/39/86/d0006025/home/htdocs/testforum/del/del.php on line 30
Warning: opendir(/cache/) [function.opendir]: failed to open dir: No such file or directory in /pages/39/86/d0006025/home/htdocs/testforum/del/del.php on line 12
Warning: readdir(): supplied argument is not a valid Directory resource in /pages/39/86/d0006025/home/htdocs/testforum/del/del.php on line 14
Warning: closedir(): supplied argument is not a valid Directory resource in /pages/39/86/d0006025/home/htdocs/testforum/del/del.php on line 22
Warning: fopen(/del/delcache.log) [function.fopen]: failed to open stream: No such file or directory in /pages/39/86/d0006025/home/htdocs/testforum/del/del.php on line 24
Warning: fwrite(): supplied argument is not a valid stream resource in /pages/39/86/d0006025/home/htdocs/testforum/del/del.php on line 29
Warning: fclose(): supplied argument is not a valid stream resource in /pages/39/86/d0006025/home/htdocs/testforum/del/del.php on line 30
PHP:
<?php
$dir1 = "cache/";
$dir2 = "cache/";
define('LOGDIR', '/del/');
deldir($dir1);
deldir($dir2);
function deldir( $dir ) {
$handle=opendir ($dir);
$i=0;
while (false !== ($file = readdir ($handle))) {
if( $file=='..' || $file=='.' ) {
continue;
}
$i++;
// echo "$i $dir$file<br>\n";
unlink($dir.$file);
}
closedir($handle);
$file=fopen(LOGDIR."delcache.log", "a");
$d = date("d.m.Y H:i:s");
$s = "$d - $dir - $i files deleted\n";
fwrite($file, $s);
fclose($file);
}
?>