
Originally Posted by
awhfy99
Thanks, I do appreciate all of the input but shared is the only thing within the budget.
To respond to an earlier reponse, I had already contacted the host and their apology was followed by a 6 month refund of hosting fees.
As for this response, I did figure out a way to keep the bmz_cache folders cleaned out. The images created on the fly are nearly as quick to load as the cached images, so this keeps over 150,000 files from bottlenecking the site. The code is pasted below, if anyone else has a need to keep their cache (or any other folders) clean. You pick the file type(s) and the folder (please test before implementing). My host uses Linux and PHP5 so it may not be universal (like for windows servers).
<?php
$some_dir0 = "../bmz_cache/0";
foreach (glob("$some_dir0/{*.gif,*.jpg,*.png,*.GIF,*.JPG,*.PNG,*.JPEG,*.jpeg}", GLOB_BRACE) as $file0)
unlink($file0);
$some_dir1 = "../bmz_cache/1";
foreach (glob("$some_dir1/{*.gif,*.jpg,*.png,*.GIF,*.JPG,*.PNG,*.JPEG,*.jpeg}", GLOB_BRACE) as $file1)
unlink($file1);
$some_dir2 = "../bmz_cache/2";
foreach (glob("$some_dir2/{*.gif,*.jpg,*.png,*.GIF,*.JPG,*.PNG,*.JPEG,*.jpeg}", GLOB_BRACE) as $file2)
unlink($file2);
$some_dir3 = "../bmz_cache/3";
foreach (glob("$some_dir3/{*.gif,*.jpg,*.png,*.GIF,*.JPG,*.PNG,*.JPEG,*.jpeg}", GLOB_BRACE) as $file3)
unlink($file3);
$some_dir4 = "../bmz_cache/4";
foreach (glob("$some_dir4/{*.gif,*.jpg,*.png,*.GIF,*.JPG,*.PNG,*.JPEG,*.jpeg}", GLOB_BRACE) as $file4)
unlink($file4);
$some_dir5 = "../bmz_cache/5";
foreach (glob("$some_dir5/{*.gif,*.jpg,*.png,*.GIF,*.JPG,*.PNG,*.JPEG,*.jpeg}", GLOB_BRACE) as $file5)
unlink($file5);
$some_dir6 = "../bmz_cache/6";
foreach (glob("$some_dir6/{*.gif,*.jpg,*.png,*.GIF,*.JPG,*.PNG,*.JPEG,*.jpeg}", GLOB_BRACE) as $file6)
unlink($file6);
$some_dir7 = "../bmz_cache/7";
foreach (glob("$some_dir7/{*.gif,*.jpg,*.png,*.GIF,*.JPG,*.PNG,*.JPEG,*.jpeg}", GLOB_BRACE) as $file7)
unlink($file7);
$some_dir8 = "../bmz_cache/8";
foreach (glob("$some_dir8/{*.gif,*.jpg,*.png,*.GIF,*.JPG,*.PNG,*.JPEG,*.jpeg}", GLOB_BRACE) as $file8)
unlink($file8);
$some_dir9 = "../bmz_cache/9";
foreach (glob("$some_dir9/{*.gif,*.jpg,*.png,*.GIF,*.JPG,*.PNG,*.JPEG,*.jpeg}", GLOB_BRACE) as $file9)
unlink($file9);
$some_dirc = "../bmz_cache/a";
foreach (glob("$some_dira/{*.gif,*.jpg,*.png,*.GIF,*.JPG,*.PNG,*.JPEG,*.jpeg}", GLOB_BRACE) as $filea)
unlink($filea);
$some_dirb = "../bmz_cache/b";
foreach (glob("$some_dirb/{*.gif,*.jpg,*.png,*.GIF,*.JPG,*.PNG,*.JPEG,*.jpeg}", GLOB_BRACE) as $fileb)
unlink($fileb);
$some_dirc = "../bmz_cache/c";
foreach (glob("$some_dirc/{*.gif,*.jpg,*.png,*.GIF,*.JPG,*.PNG,*.JPEG,*.jpeg}", GLOB_BRACE) as $filec)
unlink($filec);
$some_dird = "../bmz_cache/d";
foreach (glob("$some_dird/{*.gif,*.jpg,*.png,*.GIF,*.JPG,*.PNG,*.JPEG,*.jpeg}", GLOB_BRACE) as $filed)
unlink($filed);
$some_dire = "../bmz_cache/e";
foreach (glob("$some_dire/{*.gif,*.jpg,*.png,*.GIF,*.JPG,*.PNG,*.JPEG,*.jpeg}", GLOB_BRACE) as $filee)
unlink($filee);
$some_dirf = "../bmz_cache/f";
foreach (glob("$some_dirf/{*.gif,*.jpg,*.png,*.GIF,*.JPG,*.PNG,*.JPEG,*.jpeg}", GLOB_BRACE) as $filef)
unlink($filef);
?>
If using for a single folder, you would delete the script after the initial unlink call.
I use the curl command in cron keep kick start it. Just use the absolute path to wherever you drop it.
There is probably a shorter solution, but this one works for me.
Bookmarks