bnumber;
$query = 'INSERT INTO '.sql_table('category')." (catid, cblog, cname, cdesc) VALUES ($catid, $blogid, 'General', 'Items that do not fit in other categories')";
$r = upgrade_query("Adding category 'general' for blog " . $blogid, $query);
// only perform next actions when insert went ok
if ($r) {
$query = 'UPDATE '.sql_table('blog')." SET bdefcat=$catid WHERE bnumber=$blogid";
upgrade_query("Setting the default category for blog $blogid to the 'General' category", $query);
$query = 'UPDATE '.sql_table('item')." SET icat=$catid WHERE iblog=$blogid";
upgrade_query("Assigning all existing items of blog $blogid to the 'General' category",$query);
}
$catid++;
}
// 5. add template parts for category lists to all templates
$query = 'SELECT tdnumber FROM '.sql_table('template_desc');
$res = sql_query($query); // get all template ids
while ($obj = mysql_fetch_object($res)) {
$tid = $obj->tdnumber; // template id
$query = 'INSERT INTO '.sql_table('template')." VALUES ($tid, 'CATLIST_HEADER', '
- \">All
');";
$query2 = 'INSERT INTO '.sql_table('template')." VALUES ($tid, 'CATLIST_LISTITEM', '- \"><%catname%>
');";
$query3 = 'INSERT INTO '.sql_table('template')." VALUES ($tid, 'CATLIST_FOOTER', '
');";
upgrade_query("Adding categorylist header to template $tid",$query);
upgrade_query("Adding categorylist item to template $tid",$query2);
upgrade_query("Adding categorylist footer to template $tid",$query3);
}
}
// 6. add content type field to skins
if(!upgrade_checkIfColumnExists('skin_desc', 'sdtype')){
$query = 'ALTER TABLE '.sql_table('skin_desc')." ADD sdtype VARCHAR(40) NOT NULL DEFAULT 'text/html'";
upgrade_query("Adding content type field to skins (text/html)", $query);
}
// 7. try to set content type for xml-rss skin to text/xml
$query = 'UPDATE '.sql_table('skin_desc')." SET sdtype='text/xml' WHERE sdname='xmlrss'";
upgrade_query("Setting content type for xmlrss skin to text/xml", $query);
// 8. add bnotifytype column to blog tables
if(0==$upgrade_failures && !upgrade_checkIfColumnExists('blog', 'bnotifytype')){
upgrade_query("Adding Notify Type Setting",
'ALTER TABLE '.sql_table('blog')." ADD bnotifytype INT(11) NOT NULL default '15';");
}else{
echo "Adding Notify Type Setting ... NOT EXECUTED\nErrors occurred during upgrade process.
";
}
}
?>