function Add_File_From_Path($bin, $file, $path, &$size, $status) { // ASSERTION - The file is open and we are not in the middle of a rolling deflation with Open_File // Grab the filesize so we can work out how to process it if (is_null($size) && ($size = @filesize($path)) === false) { $size = OBFW_Tidy_Exception(); $size = OBFW_FOpen_Exception($path, $size); return true; } // No mod time specified? Find it now if (!array_key_exists('mod_time', $status)) { if (($status['mod_time'] = @filemtime($path)) === false) { $size = OBFW_Tidy_Exception(); $size = OBFW_FOpen_Exception($path, $size); return true; } } // Check size constraints if ($size > $this->filesize_limit[0]) { // File is bigger than what we have set as our maximum size! $size = sprintf($this->filesize_limit[1], WPOnlineBackup_Formatting::Fix_B($this->filesize_limit[0]), WPOnlineBackup_Formatting::Fix_B($size)); return true; } else { if (4 + 44 + strlen($file) > $this->datasize_limit[0] - $this->indx_disk->Pos()) { // Adding this file will send our indx disk over the limit! // We check the data disk during compression since we don't know the compressed size just yet $total_size = $this->indx_disk->Pos() + 4 + 44 + strlen($file); $size = array(sprintf($this->datasize_limit[1], WPOnlineBackup_Formatting::Fix_B($this->datasize_limit[0]), WPOnlineBackup_Formatting::Fix_B($total_size)), sprintf($this->datasize_limit[2], WPOnlineBackup_Formatting::Fix_B($total_size))); return false; } } // Compress in one go treating as a string, or piece by piece? if ($size > $this->WPOnlineBackup->Get_Setting('max_block_size')) { if (true !== ($ret = $this->Add_Large_File($bin, $file, $path, $size, $status))) { return $ret; } $this->files++; return true; } else { if (($data = @file_get_contents($path)) === false) { $size = OBFW_Tidy_Exception(); return true; } $size = strlen($data); return $this->_Add_File_From_String($bin, $file, $size, $data, $status); } }
function Fetch_Stat($file) { if (($file_size = @filesize($file)) === false) { $ret = OBFW_Tidy_Exception(); return OBFW_FOpen_Exception($file, $ret); } if (($mod_time = @filemtime($file)) === false) { $ret = OBFW_Tidy_Exception(); return OBFW_FOpen_Exception($file, $ret); } return compact('file_size', 'mod_time'); }
function Add_File_From_Path($bin, $file, $path, &$size, $status) { // ASSERTION - The file is open and we are not in the middle of a rolling deflation with Open_File // Grab the filesize so we can work out how to process it if (is_null($size) && false === ($size = @filesize($path))) { $size = OBFW_Tidy_Exception(); $size = OBFW_FOpen_Exception($path, $size); return true; } // No mod time specified? Find it now if (!isset($status['mod_time'])) { if (false === ($status['mod_time'] = @filemtime($path))) { $size = OBFW_Tidy_Exception(); $size = OBFW_FOpen_Exception($path, $size); return true; } } // Compress in one go treating as a string, or piece by piece? if ($size > $this->WPOnlineBackup->Get_Setting('max_block_size')) { if (true !== ($ret = $this->Add_Large_File($bin, $file, $path, $size, $status))) { return $ret; } return true; } else { if (false === ($data = @file_get_contents($path))) { $size = OBFW_Tidy_Exception(); return true; } $size = strlen($data); return $this->Add_File_From_String($bin, $file, $size, $data, $status); } }