Re: How to get File Galleries info from Database?
Hi again,
To reply to my own question, I offer a solution I found after sifting through the Tikiwiki library code. I'm not sure about its efficiency so I ask knowledgeable people to please comment.
Inside a plugin function of named wikiplugin_myplugin($data, $params) I write:
code
global $tikilib;
$gallery = 'MyGallery';
$filename = 'MyFile.txt';
$queryGallery = "select * from tiki_file_galleries where name='".$gallery."'";
$resultGallery = $tikilib->db->query($queryGallery);
$res = $resultGallery->fetchRow();
$galleryId = $res'galleryId';
$queryFilename = "select * from tiki_files where filename='".$filename."' and galleryId='".$galleryId."'";
$resultFilename = $tikilib->db->query($queryFilename);
$res = $resultFilename->fetchRow();
return "MD5: ".$res'path'.".";
/code
This returns the HTML string giving the 32-characters MD5-like filename stored in the /var/lib/tikiwiki_files corresponding to the binary file 'MyFile.txt' uploaded to the Tikiwiki gallery 'MyGallery'. Further exercises are left to the reader 😁 .