X-Git-Url: https://git.nirgal.com/?p=squasher.git;a=blobdiff_plain;f=webroot%2Fsquasher.class.php;h=d83906f898ab6b0ce146892bad6b070efa49e8fc;hp=f59304e6b658f4638cc7d243fb1bead5660b6bf8;hb=HEAD;hpb=2d2d10d4294be94e344c225857b64e37b1c64c62 diff --git a/webroot/squasher.class.php b/webroot/squasher.class.php index f59304e..d83906f 100644 --- a/webroot/squasher.class.php +++ b/webroot/squasher.class.php @@ -559,12 +559,14 @@ function read_single_file($path, $file) { if ($this->got_rights_array($path) > 0) { if (is_file($fsfilename.'.Completed')) $ext='.Completed'; - if (is_file($fsfilename.'.InProgress')) + elseif (is_file($fsfilename.'.InProgress')) $ext='.InProgress'; - if (is_file($fsfilename.'.Starting')) + elseif (is_file($fsfilename.'.Starting')) $ext='.Starting'; - if (is_file($fsfilename.'.Processed')) + elseif (is_file($fsfilename.'.Processed')) $ext='.Processed'; + else + return false; $fsfilename .= $ext; $handle = @fopen($fsfilename, "rb"); $sub_pos = strpos($file, $ext); @@ -598,8 +600,10 @@ function read_single_file($path, $file) { #$this->update_hash($h,$path."/".$config[$i][2]); //check stats $this->check_stats($h); + return true; } } + return false; } @@ -648,51 +652,51 @@ function read_directory($path, $getsubs=false, $getfirstfiles=true, $getdeepfile } elseif ($getfirstfiles) { //squashed files if ($this->got_rights_array($path) > 0) { - if (strpos($filename, '.Completed') || strpos($filename, '.InProgress') || strpos($filename, '.Starting') || strpos($filename, '.Processed')) { - $i++; - $handle = @fopen($fsfilename, "rb"); - if (strpos($file,'.Completed')) - $ext='.Completed'; - if (strpos($file,'.InProgress')) - $ext='.InProgress'; - if (strpos($file,'.Starting')) - $ext='.Starting'; - if (strpos($file,'.Processed')) - $ext='.Processed'; - $sub_pos = strpos($file, $ext); - $base_name = substr($file, 0, $sub_pos); - $filecontent = @fread($handle, @filesize($fsfilename)); - $config[$i] = explode("\r\n", $filecontent); - - /*** - * $config:: array - * [0] -> versioncode - * [1] -> date&time - * [2] -> filename - * [3] -> filesize - * [4] -> chunksize - * [5] -> chunkcount - * [6] -> CRC32 checksum - ***/ - - if (@filesize($fsfilename) > 0) { - $h = md5($path."/".$config[$i][2]); - $this->configs[$h] = $config[$i]; - $this->configs[$h]['squashed'] = true; - $this->configs[$h]['path'] = $path; - $this->configs[$h]['status'] = substr($ext, 1); - $this->configs[$h]['mime'] = $this->set_mime($this->configs[$h][2]); - $this->configs[$h]['hidden'] = is_file(SQUASHER_UPLOADS_DIR.$path.'/'.$base_name.'.hidden'); - //to prevent dates of 1-1-1970 we set te dates of the config file - $this->configs[$h]['added'] = filectime($fsfilename); - $this->configs[$h]['lastchange'] = filemtime($fsfilename); - fclose($handle); - $this->populate_stats($path, $h); - //insert hash in db - $this->update_hash($h, $path."/".$config[$i][2]); - //check stats - $this->check_stats($h); - } + if (strpos($file,'.Completed')) + $ext='.Completed'; + elseif (strpos($file,'.InProgress')) + $ext='.InProgress'; + elseif (strpos($file,'.Starting')) + $ext='.Starting'; + elseif (strpos($file,'.Processed')) + $ext='.Processed'; + else + continue; + $i++; + $handle = @fopen($fsfilename, "rb"); + $sub_pos = strpos($file, $ext); + $base_name = substr($file, 0, $sub_pos); + $filecontent = @fread($handle, @filesize($fsfilename)); + $config[$i] = explode("\r\n", $filecontent); + + /*** + * $config:: array + * [0] -> versioncode + * [1] -> date&time + * [2] -> filename + * [3] -> filesize + * [4] -> chunksize + * [5] -> chunkcount + * [6] -> CRC32 checksum + ***/ + + if (@filesize($fsfilename) > 0) { + $h = md5($path."/".$config[$i][2]); + $this->configs[$h] = $config[$i]; + $this->configs[$h]['squashed'] = true; + $this->configs[$h]['path'] = $path; + $this->configs[$h]['status'] = substr($ext, 1); + $this->configs[$h]['mime'] = $this->set_mime($this->configs[$h][2]); + $this->configs[$h]['hidden'] = is_file(SQUASHER_UPLOADS_DIR.$path.'/'.$base_name.'.hidden'); + //to prevent dates of 1-1-1970 we set te dates of the config file + $this->configs[$h]['added'] = filectime($fsfilename); + $this->configs[$h]['lastchange'] = filemtime($fsfilename); + fclose($handle); + $this->populate_stats($path, $h); + //insert hash in db + $this->update_hash($h, $path."/".$config[$i][2]); + //check stats + $this->check_stats($h); } } }