26 lines
824 B
PHP
26 lines
824 B
PHP
<?php
|
|
/******************************************************************************
|
|
* YMS - Yacht Management Software
|
|
* Copyright (C) 2024 Thomas Hooge
|
|
*
|
|
* SPDX-License-Identifier: WTFPL
|
|
******************************************************************************
|
|
|
|
*/
|
|
|
|
// ========== FILE FUNCTIONS ==================================================
|
|
|
|
function file_fix_filesize($docid, $filepath) {
|
|
// set filesize in database to current size in filesystem
|
|
global $pdo;
|
|
$newsize = filesize($filepath);
|
|
$sth = $pdo->prepare("UPDATE document SET docsize=? WHERE docid=?");
|
|
$sth->execute([$docid, $newsize]);
|
|
return $newsize;
|
|
}
|
|
|
|
function file_get_docname($docid, $doctype, $extension) {
|
|
global $g_doc_typemap;
|
|
return sprintf('%s-%06d.%s', $g_doc_typemap[$doctype], $docid, $extension);
|
|
}
|