40 $Sql =
"SELECT mimetype_name 42 INNER JOIN pfile ON pfile_pk = pfile_fk 43 INNER JOIN mimetype ON pfile.pfile_mimetypefk = mimetype.mimetype_pk 44 WHERE uploadtree_pk = $Item LIMIT 1;";
45 $result = pg_query($PG_CONN, $Sql);
47 if (pg_num_rows($result) > 0) {
48 $row = pg_fetch_assoc($result);
49 $Meta = $row[
'mimetype_name'];
51 $Meta =
'application/octet-stream';
54 pg_free_result($result);
74 if (empty($PG_CONN)) {
78 $sql =
"SELECT * FROM pfile WHERE pfile_pk = $PfilePk LIMIT 1;";
79 $result = pg_query($PG_CONN, $sql);
81 $Row = pg_fetch_assoc($result);
82 pg_free_result($result);
83 if (empty($Row[
'pfile_sha1'])) {
86 $Hash = $Row[
'pfile_sha1'] .
"." . $Row[
'pfile_md5'] .
"." . $Row[
'pfile_size'];
87 exec(
"$LIBEXECDIR/reppath $Repo $Hash", $Path);
106 if (empty($PG_CONN)) {
110 $sql =
"SELECT * FROM pfile INNER JOIN uploadtree ON pfile_fk = pfile_pk 111 WHERE uploadtree_pk = $Item LIMIT 1;";
112 $result = pg_query($PG_CONN, $sql);
114 $Row = pg_fetch_assoc($result);
115 pg_free_result($result);
116 if (empty($Row[
'pfile_sha1'])) {
119 $Hash = $Row[
'pfile_sha1'] .
"." . $Row[
'pfile_md5'] .
"." . $Row[
'pfile_size'];
120 exec(
"$LIBEXECDIR/reppath $Repo $Hash", $Path);
RepPath($PfilePk, $Repo="files")
Given a pfile id, retrieve the pfile path.
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
DBCheckResult($result, $sql, $filenm, $lineno)
Check the postgres result for unexpected errors. If found, treat them as fatal.
GetMimeType($Item)
Given an uploadtree_pk, return a string that describes the mime type.