setQuery("SELECT COUNT(*) FROM #__fb_attachments WHERE filelocation LIKE '%com_fireboard/uploaded%'", 0, 1);
// if >0 then it means we are on fb version below 1.0.2
$is_101_version = $kunena_db->loadResult();
if ($is_101_version) {
// now do the upgrade
$kunena_db->setQuery("update #__fb_attachments set filelocation = replace(filelocation,'{$root}/components/com_fireboard/uploaded','/images/fbfiles');");
if ($kunena_db->query()) print '
Attachment table successfully upgraded to 1.0.2+ version schema!';
else
{
print 'Attachment table was not successfully upgraded to 1.0.2+ version schema!';
trigger_dbwarning("Unable to upgrade attachement table.");
}
$kunena_db->setQuery("update #__fb_messages_text set message = replace(message,'/components/com_fireboard/uploaded','/images/fbfiles');");
if ($kunena_db->query()) print 'Attachments in messages table successfully upgraded to 1.0.2+ version schema!';
else
{
print 'Attachments in messages table were not successfully upgraded to 1.0.2+ version schema!';
trigger_dbwarning("Unable to upgrade attachements in messages table.");
}
//backward compatibility . all the cats are by default moderated
$kunena_db->setQuery("UPDATE `#__fb_categories` SET `moderated` = '1';");
$kunena_db->query() or trigger_dbwarning("Unable to update categories.");;
}
?>