Hi,
my first patch and hopefully thre are more to come
it's just a small change in the way image_cache is cleaned in mythweb
i have alot of shows that are more than a week old
and it was a pain to have the thumbnail images recreated for them every time
risto
ps
i used file_exists instead of is_file on purpose
since is_file generated errors on my system for files larger than 2gb
--- includes/init.php 2005-02-11 02:57:51.000000000 -0700
+++ includes/init.php 2005-02-18 04:28:42.000000000 -0700
@@ -97,18 +97,18 @@
'LGE-', // LG phones
);
if (strpos(strtoupper($_SERVER['HTTP_ACCEPT']),"VND.WAP.WML") > 0 // The browser/gateway says it accepts WML.
- || in_array(substr(trim($_SERVER['HTTP_USER_AGENT']), 0, 4), $wap_agents)) {
+ || in_array(substr(trim($_SERVER['HTTP_USER_AGENT']), 0, 4), $wap_agents)) {
// This browser is WAP. Now check if it supports html or wml
- if (strpos(strtoupper($_SERVER['HTTP_ACCEPT']),"TEXT/HTML") !== false) {
- define('Theme', 'wap');
- }
+ if (strpos(strtoupper($_SERVER['HTTP_ACCEPT']),"TEXT/HTML") !== false) {
+ define('Theme', 'wap');
+ }
// browser didn't explicitly state html, use wml only.
- else {
- define('Theme', 'wml');
- }
- }
+ else {
+ define('Theme', 'wml');
+ }
+ }
elseif (strpos($_SERVER['HTTP_USER_AGENT'],"MythPhone") !== false) // The browser is MythPhone
- define('Theme', 'vxml');
+ define('Theme', 'vxml');
// Load the theme from session data?
elseif (file_exists('themes/'.$_SESSION['Theme'].'/theme.php') && !$_GET['RESET_THEME'] && !$_POST['RESET_THEME'])
define('Theme', $_SESSION['Theme']);
@@ -142,12 +142,23 @@
// Clean out stale thumbnails
if ($dir = opendir(image_cache)) {
- while (($file = readdir($dir))) {
- if (!is_file(image_cache.'/'.$file) || !ereg('\\.(png|jpg|gif)$', $file))
- continue;
- // Delete files older than the last week.
- if (filemtime(image_cache.'/'.$file) < time() - 7 * 24 * 60 * 60)
- unlink(image_cache.'/'.$file);
+ if (is_dir(video_dir)) {
+ while (($file = readdir($dir))) {
+ if (!is_file(image_cache.'/'.$file) || !ereg('\\.(png|jpg|gif)$', $file))
+ continue;
+ $videofile = preg_replace("/\\.(png|jpg|gif)/","",$file);
+ if (!file_exists(video_dir.'/'.$videofile))
+ unlink(image_cache.'/'.$file);
+ }
+ }
+ else {
+ while (($file = readdir($dir))) {
+ if (!is_file(image_cache.'/'.$file) || !ereg('\\.(png|jpg|gif)$', $file))
+ continue;
+ // Delete files older than the last week.
+ if (filemtime(image_cache.'/'.$file) < time() - 7 * 24 * 60 * 60)
+ unlink(image_cache.'/'.$file);
+ }
}
closedir($dir);
clearstatcache();
_______________________________________________
mythtv-dev mailing list
[email protected]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev