|
|
|
@ -240,11 +240,21 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) |
|
|
|
|
//migrate categories |
|
|
|
|
$sql_orig = "SELECT * FROM bb_categories"; |
|
|
|
|
$res_orig = mysql_query($sql_orig); |
|
|
|
|
$order = 1; |
|
|
|
|
while($row = mysql_fetch_array($res_orig)){ |
|
|
|
|
$myorder = (empty($row['cat_order'])?$order:$row['cat_order']); |
|
|
|
|
$sql = "INSERT INTO forum_category " . |
|
|
|
|
"(cat_id,cat_title,cat_comment,cat_order,locked) VALUES " . |
|
|
|
|
"('".$row['cat_id']."','".$row['cat_title']."','','".$row['cat_order']."',0)"; |
|
|
|
|
"('".$row['cat_id']."','".mysql_real_escape_string($row['cat_title'])."','','".$myorder."',0)"; |
|
|
|
|
$res = mysql_query($sql); |
|
|
|
|
$lastcatid = mysql_insert_id(); |
|
|
|
|
error_log($sql,0); |
|
|
|
|
$order ++; |
|
|
|
|
//add item_property - forum categories were not put into item_properties before |
|
|
|
|
$sql = "INSERT INTO item_property (tool,insert_user_id,ref,lastedit_type,lastedit_user_id,visibility) " . |
|
|
|
|
"VALUES ('forum_category','1','$lastcatid','ForumCategoryAdded','1','1')"; |
|
|
|
|
$res = mysql_query($sql); |
|
|
|
|
error_log($sql,0); |
|
|
|
|
} |
|
|
|
|
$sql_orig = "SELECT * FROM bb_forums ORDER BY forum_last_post_id desc"; |
|
|
|
|
$res_orig = mysql_query($sql_orig); |
|
|
|
@ -256,47 +266,73 @@ if (defined('DOKEOS_INSTALL') || defined('DOKEOS_COURSE_UPDATE')) |
|
|
|
|
"forum_last_post, forum_threads," . |
|
|
|
|
"locked, forum_posts, " . |
|
|
|
|
"allow_new_threads, forum_order) VALUES " . |
|
|
|
|
"('".$row['forum_id']."','".$row['cat_id']."',1,'".$row['forum_desc']."'," . |
|
|
|
|
"'".$row['forum_name']."'," . |
|
|
|
|
"('".$row['forum_id']."','".$row['cat_id']."',1,'".mysql_real_escape_string($row['forum_desc'])."'," . |
|
|
|
|
"'".mysql_real_escape_string($row['forum_name'])."'," . |
|
|
|
|
"'".$row['forum_last_post_id']."','".$row['forum_topics']."'," . |
|
|
|
|
"0,'".$row['forum_posts']."'," . |
|
|
|
|
"1,$order)"; |
|
|
|
|
error_log($sql,0); |
|
|
|
|
$res = mysql_query($sql); |
|
|
|
|
$lastforumid = mysql_insert_id(); |
|
|
|
|
$order++; |
|
|
|
|
|
|
|
|
|
//add item_property - forums were not put into item_properties before |
|
|
|
|
$sql = "INSERT INTO item_property (tool,insert_user_id,ref,lastedit_type,lastedit_user_id,visibility) " . |
|
|
|
|
"VALUES ('forum','1','$lastforumid','ForumAdded','1','1')"; |
|
|
|
|
$res = mysql_query($sql); |
|
|
|
|
error_log($sql,0); |
|
|
|
|
} |
|
|
|
|
$sql_orig = "SELECT * FROM bb_topics"; |
|
|
|
|
$res_orig = mysql_query($sql_orig); |
|
|
|
|
while($row = mysql_fetch_array($res_orig)){ |
|
|
|
|
//convert time from varchar to datetime |
|
|
|
|
$time = $row['topic_time']; |
|
|
|
|
$name = $row['prenom']." ".$row['nom']; |
|
|
|
|
$poster_id = ($row['topic_poster']==-1?1:$row['topic_poster']); |
|
|
|
|
$name = mysql_real_escape_string($row['prenom']." ".$row['nom']); |
|
|
|
|
$sql = "INSERT INTO forum_thread " . |
|
|
|
|
"(thread_id,forum_id,thread_poster_id," . |
|
|
|
|
"locked,thread_replies,thread_sticky,thread_title," . |
|
|
|
|
"thread_poster_name, thread_date, thread_last_post," . |
|
|
|
|
"thread_views) VALUES " . |
|
|
|
|
"('".$row['topic_id']."','".$row['forum_id']."','".$row['topic_poster']."'," . |
|
|
|
|
"0,'".$row['topic_replies']."',0,'".$row['topic_title']."'," . |
|
|
|
|
"('".$row['topic_id']."','".$row['forum_id']."','".$poster_id."'," . |
|
|
|
|
"0,'".$row['topic_replies']."',0,'".mysql_real_escape_string($row['topic_title'])."'," . |
|
|
|
|
"'$name','$time','".$row['topic_last_post_id']."'," . |
|
|
|
|
"'".$row['topic_views']."')"; |
|
|
|
|
error_log($sql,0); |
|
|
|
|
$res = mysql_query($sql); |
|
|
|
|
$lastthreadid = mysql_insert_id(); |
|
|
|
|
|
|
|
|
|
//add item_property - forum threads were not put into item_properties before |
|
|
|
|
$sql = "INSERT INTO item_property (tool,insert_user_id,ref,lastedit_type,lastedit_user_id,visibility) " . |
|
|
|
|
"VALUES ('forum_thread','1','$lastthreadid','ForumThreadAdded','1','1')"; |
|
|
|
|
$res = mysql_query($sql); |
|
|
|
|
error_log($sql,0); |
|
|
|
|
} |
|
|
|
|
$sql_orig = "SELECT * FROM bb_posts, bb_posts_text WHERE bb_posts.post_id = bb_posts_text.post_id"; |
|
|
|
|
$res_orig = mysql_query($sql_orig); |
|
|
|
|
while($row = mysql_fetch_array($res_orig)){ |
|
|
|
|
//convert time from varchar to datetime |
|
|
|
|
$time = $row['post_time']; |
|
|
|
|
$name = $row['prenom']." ".$row['nom']; |
|
|
|
|
$poster_id = ($row['topic_poster']==-1?1:$row['topic_poster']); |
|
|
|
|
$name = mysql_real_escape_string($row['prenom']." ".$row['nom']); |
|
|
|
|
$sql = "INSERT INTO forum_post " . |
|
|
|
|
"(post_id,forum_id,thread_id," . |
|
|
|
|
"poster_id,post_parent_id,visible, " . |
|
|
|
|
"post_title,poster_name, post_text, " . |
|
|
|
|
"post_date, post_notification) VALUES " . |
|
|
|
|
"('".$row['post_id']."','".$row['forum_id']."','".$row['topic_id']."'," . |
|
|
|
|
"'".$row['poster_id']."','".$row['parent_id']."',1," . |
|
|
|
|
"'".$row['post_title']."','$name', '".$row['post_text']."'," . |
|
|
|
|
"'".$poster_id."','".$row['parent_id']."',1," . |
|
|
|
|
"'".mysql_real_escape_string($row['post_title'])."','$name', '".mysql_real_escape_string($row['post_text'])."'," . |
|
|
|
|
"'$time',0)"; |
|
|
|
|
error_log($sql,0); |
|
|
|
|
$res = mysql_query($sql); |
|
|
|
|
$lastpostid = mysql_insert_id(); |
|
|
|
|
|
|
|
|
|
//add item_property - forum threads were not put into item_properties before |
|
|
|
|
$sql = "INSERT INTO item_property(tool,insert_user_id,ref,lastedit_type,lastedit_user_id,visibility) " . |
|
|
|
|
"VALUES ('forum_post','1','$lastpostid','ForumPostAdded','1','1')"; |
|
|
|
|
$res = mysql_query($sql); |
|
|
|
|
error_log($sql,0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|