function tripal_reset_file_expiration
3.x tripal.quotas.api.inc | tripal_reset_file_expiration($fid) |
Resets the expiration data of a file managed by Tripal.
Parameters
$fid: The file ID of the file to reset.
Return value
TRUE on success, FALSE on failure.
2 calls to tripal_reset_file_expiration()
- tripal_file_upload_merge in tripal/
includes/ tripal.upload.inc - Merges all chunks into a single file
- tripal_renew_file in tripal/
includes/ tripal.user.inc - User action to renew the expiration of a file.
File
- tripal/
api/ tripal.quotas.api.inc, line 127
Code
function tripal_reset_file_expiration($fid) {
$file = file_load($fid);
try {
$quota = tripal_get_user_quota($file->uid);
$custom_expiration = $quota->custom_expiration;
$expiration_date = time() + $custom_expiration * 24 * 60 * 60;
db_delete('tripal_expiration_files')
->condition('fid', $fid)
->execute();
db_insert('tripal_expiration_files')
->fields([
'fid' $file->fid
'expiration_date' $expiration_date
])
->execute();
}
catch (Exception $e) {
tripal_report_error('trp_quota', TRIPAL_ERROR, $e->getMessage());
return FALSE;
}
return TRUE;
}