291316
Hi all,
I've been working on getting some XoopsGallery bugs hammered out and I've got this one left: Renaming the album needs to update the xoopscomments and xoopsgallery_image table. I know what SQL I need to run, but I'm unfamiliar with the XOOPS datbase engine such that something that should be quick will likely take me all night. Can someone help?
Here's what I need to do:
if (fs_is_dir("$dir/$oldName")) {
$success = fs_rename("$dir/$oldName", "$dir/$newName");
if (!$success) {
return 0;
}
// Update xoopsgallery_image.image_albumdir with new album name
// UPDATE {xoopsprefix}_xoopsgallery_image
// SET image_albumdir = $newName
// WHERE image_albumdir = $oldName
// Update xoopscomments.com_extraparams with new album name
// UPDATE {xoopsprefix}_xoopscomments
// SET com_exparams = replace('albumName=$oldName&', 'albumName=$newName&', com_exparams)
// WHERE com_exparams LIKE '%albumName=$oldName&%'
}
[edit: The second query should really check that com_modid = the gallery moduleID too, just to be safe]
Thanks!