function tripal_file_upoad_write_log
3.x tripal.upload.inc | tripal_file_upoad_write_log($temp_dir, $log) |
Writes the upload log file.
The log file is used to keep track of which chunks have been uploaded. The format is an array with a key of 'chunks_written' which each element a key/value pair containing the chunk index as the key and the chunk size as the value.
Parameters
$temp_dir: The directory where the log file will be written. It must be a unique directory where only chunks from a single file are kept.
$log: The log array, that is serialized and then written to the file.
1 call to tripal_file_upoad_write_log()
- tripal_file_upload_put in tripal/
includes/ tripal.upload.inc - Saves the contents of the file being sent to the server.
File
- tripal/
includes/ tripal.upload.inc, line 356
Code
function tripal_file_upoad_write_log($temp_dir, $log) {
$log_file = $temp_dir . '/tripal_upload.log';
if (!$log or !is_array($log)) {
$log = array(
'chunks_written' => array(),
);
}
// Get the last chunk read
$fh = fopen($log_file, "w");
if ($fh and flock($fh, LOCK_EX)) {
fwrite($fh, serialize($log));
}
flock($fh, LOCK_UN);
fclose($fh);
}