29 $Sql =
"SELECT mimetype_name
31 INNER JOIN pfile ON pfile_pk = pfile_fk
32 INNER JOIN mimetype ON pfile.pfile_mimetypefk = mimetype.mimetype_pk
33 WHERE uploadtree_pk = $Item LIMIT 1;";
36 if (pg_num_rows($result) > 0) {
37 $row = pg_fetch_assoc($result);
38 $Meta = $row[
'mimetype_name'];
40 $Meta =
'application/octet-stream';
43 pg_free_result($result);
67 $sql =
"SELECT * FROM pfile WHERE pfile_pk = $PfilePk LIMIT 1;";
70 $Row = pg_fetch_assoc($result);
71 pg_free_result($result);
72 if (empty($Row[
'pfile_sha1'])) {
75 $Hash = $Row[
'pfile_sha1'] .
"." . $Row[
'pfile_md5'] .
"." . $Row[
'pfile_size'];
76 exec(
"$LIBEXECDIR/reppath $Repo ".escapeshellarg($Hash), $Path);
99 $sql =
"SELECT * FROM pfile INNER JOIN uploadtree ON pfile_fk = pfile_pk
100 WHERE uploadtree_pk = $Item LIMIT 1;";
103 $Row = pg_fetch_assoc($result);
104 pg_free_result($result);
105 if (empty($Row[
'pfile_sha1'])) {
108 $Hash = $Row[
'pfile_sha1'] .
"." . $Row[
'pfile_md5'] .
"." . $Row[
'pfile_size'];
109 exec(
"$LIBEXECDIR/reppath $Repo ".escapeshellarg($Hash), $Path);
DBCheckResult($result, $sql, $filenm, $lineno)
Check the postgres result for unexpected errors. If found, treat them as fatal.
RepPath($PfilePk, $Repo="files")
Given a pfile id, retrieve the pfile path.
GetMimeType($Item)
Given an uploadtree_pk, return a string that describes the mime type.
RepPathItem($Item, $Repo="files")
Given an uploadtree_pk, retrieve the pfile path.
foreach($Options as $Option=> $OptVal) if(0==$reference_flag &&0==$nomos_flag) $PG_CONN