Package: ampache
Version: 20100409-1
Severity: normal

distribution: debian-stable
PHP-Version: libapache2-mod-php5 5.3.3-7+squeeze1

I had 13GB of logfiles in about 2h. The following patch fixes the problem:

--- /tmp/album.class.php        2011-04-26 18:19:07.983661221 +0200
+++ ampache-3.5.4/lib/class/album.class.php     2011-04-26 18:18:04.000000000 
+0200
@@ -489,38 +489,37 @@ class Album extends database_object {
                                Error::add('general',_('Error: Unable to open') 
. ' ' . $dir); 
                                debug_event('read',"Error: Unable to open $dir 
for album art read",'2');
                        }
-                       else {
-                               /* Recurse through this dir and create the 
files array */
-                               while ( FALSE !== ($file = @readdir($handle)) ) 
{
-                                       $extension = 
substr($file,strlen($file)-3,4);
-
-                                       /* If it's an image file */
-                                       if ($extension == "jpg" || $extension 
== "gif" || $extension == "png" || $extension == "jp2") { 
-
-                                               if ($extension == 'jpg') { 
$extension = 'jpeg'; } 
-
-                                               // HACK ALERT this is to 
prevent duplicate filenames
-                                               $full_filename  = $dir . '/' . 
$file; 
-                                               $index          = 
md5($full_filename); 
-
-                                               /* Make sure it's got something 
in it */
-                                               if (!filesize($dir . '/' . 
$file)) { continue; } 
-
-                                               if ($file == 
$preferred_filename) { 
-                                                       // If we found the 
preferred filename we're done, wipe out previous results
-                                                       $data = 
array(array('file' => $full_filename, 'mime' => 'image/' . $extension));
-                                                       return $data;
-                                               }
-                                               elseif (!isset($cache[$index])) 
{
-                                                       $data[] = array('file' 
=> $full_filename, 'mime' => 'image/' . $extension);
-                                               }
+
+                       /* Recurse through this dir and create the files array 
*/
+                       while ( FALSE !== ($file = @readdir($handle)) ) {
+                               $extension = substr($file,strlen($file)-3,4);
+
+                               /* If it's an image file */
+                               if ($extension == "jpg" || $extension == "gif" 
|| $extension == "png" || $extension == "jp2") { 
+
+                                       if ($extension == 'jpg') { $extension = 
'jpeg'; } 
+
+                                       // HACK ALERT this is to prevent 
duplicate filenames
+                                       $full_filename  = $dir . '/' . $file; 
+                                       $index          = md5($full_filename); 
+
+                                       /* Make sure it's got something in it */
+                                       if (!filesize($dir . '/' . $file)) { 
continue; } 
+
+                                       if ($file == $preferred_filename) { 
+                                               // If we found the preferred 
filename we're done, wipe out previous results
+                                               $data = array(array('file' => 
$full_filename, 'mime' => 'image/' . $extension));
+                                               return $data;
+                                       }
+                                       elseif (!isset($cache[$index])) {
+                                               $data[] = array('file' => 
$full_filename, 'mime' => 'image/' . $extension);
+                                       }
                                
-                                               $cache[$index] = '1'; 
+                                       $cache[$index] = '1'; 
                                
-                                       } // end if it's an image
+                               } // end if it's an image
                                
-                               } // end while reading dir
-                       }
+                       } // end while reading dir
                        @closedir($handle);
                        
                        if (!empty($limit) && $limit < count($data)) { 



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to