1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 21:27:25 +02:00

EONE-1, progress on forum upgrade. Migration of forum threads and posts now works again.

This commit is contained in:
mcfly
2010-03-07 15:09:28 +00:00
parent 2f4926b476
commit 7df6f8093d

View File

@@ -296,8 +296,8 @@ function step4()
$tmp = array(); $tmp = array();
$tmp['track_userid'] = $userId; $tmp['track_userid'] = $userId;
$tmp['track_thread'] = $threadId; $tmp['track_thread'] = $threadId;
$tmp['_FIELD_TYPES']['track_userid'] = 'int'; // $tmp['_FIELD_TYPES']['track_userid'] = 'int';
$tmp['_FIELD_TYPES']['track_thread'] = 'int'; // $tmp['_FIELD_TYPES']['track_thread'] = 'int';
$e107->sql->db_Insert('forum_track', $tmp); $e107->sql->db_Insert('forum_track', $tmp);
} }
@@ -339,6 +339,7 @@ function step5()
return; return;
} }
/*
$ftypes['_FIELD_TYPES']['forum_id'] = 'int'; $ftypes['_FIELD_TYPES']['forum_id'] = 'int';
$ftypes['_FIELD_TYPES']['forum_parent'] = 'int'; $ftypes['_FIELD_TYPES']['forum_parent'] = 'int';
$ftypes['_FIELD_TYPES']['forum_sub'] = 'int'; $ftypes['_FIELD_TYPES']['forum_sub'] = 'int';
@@ -351,7 +352,7 @@ function step5()
$ftypes['_FIELD_TYPES']['forum_order'] = 'int'; $ftypes['_FIELD_TYPES']['forum_order'] = 'int';
$ftypes['_FIELD_TYPES']['forum_postclass'] = 'int'; $ftypes['_FIELD_TYPES']['forum_postclass'] = 'int';
$ftypes['_FIELD_TYPES']['forum_threadclass'] = 'int'; $ftypes['_FIELD_TYPES']['forum_threadclass'] = 'int';
*/
$counts = array('parens' => 0, 'forums' => 0, 'subs' => 0); $counts = array('parens' => 0, 'forums' => 0, 'subs' => 0);
if($e107->sql->db_Select('forum')) if($e107->sql->db_Select('forum'))
@@ -375,7 +376,7 @@ function step5()
$tmp = $forum; $tmp = $forum;
$tmp['forum_threadclass'] = $tmp['forum_postclass']; $tmp['forum_threadclass'] = $tmp['forum_postclass'];
$tmp['forum_options'] = '_NULL_'; $tmp['forum_options'] = '_NULL_';
$tmp['_FIELD_TYPES'] = $ftypes['_FIELD_TYPES']; // $tmp['_FIELD_TYPES'] = $ftypes['_FIELD_TYPES'];
$e107->sql->db_Insert('forum_new', $tmp); $e107->sql->db_Insert('forum_new', $tmp);
} }
@@ -418,7 +419,7 @@ function step6()
if(!isset($_POST['move_thread_data'])) if(!isset($_POST['move_thread_data']))
{ {
$count = $e107->sql->db_Count('forum_t', '(*)', "WHERE thread_parent = 0 AND thread_id > {$lastThread}"); $count = $e107->sql->db_Count('forum_t', '(*)', "WHERE thread_parent = 0 AND thread_id > {$lastThread}");
$limitDropdown = createThreadLimitDropdown($count); $limitDropdown = createThreadLimitDropdown($count);
$text = " $text = "
<form method='post'> <form method='post'>
@@ -439,7 +440,7 @@ function step6()
return; return;
} }
$count = $e107->sql->db_Count('forum_t', '(*)', "WHERE thread_parent = 0 AND thread_id > {$lastThread}"); $count = $e107->sql->db_Count('forum_t', '(*)', "WHERE thread_parent=0 AND thread_id>{$lastThread}");
if($count === false) if($count === false)
{ {
echo "error: Unable to determine last thread id"; echo "error: Unable to determine last thread id";
@@ -477,14 +478,15 @@ function step6()
$text .= '<br />Successfully converted '.count($threadList)." threads and {$postCount} replies.<br />"; $text .= '<br />Successfully converted '.count($threadList)." threads and {$postCount} replies.<br />";
$text .= "Last thread id = {$t['thread_id']}<br />"; $text .= "Last thread id = {$t['thread_id']}<br />";
$count = $e107->sql->db_Count('forum_t', '(*)', "WHERE thread_parent = 0 AND thread_id > {$f->updateInfo['lastThread']}"); $count = $e107->sql->db_Count('forum_t', '(*)', "WHERE thread_parent = 0 AND thread_id > {$f->updateInfo['lastThread']}");
if($count) if($count)
{ {
$limitDropdown = createThreadLimitDropdown($count); $limitDropdown = createThreadLimitDropdown($count);
$text .= " $text .= "
<form method='post'>
We still have {$count} threads remaining to convert, do them in steps of {$limitDropdown} We still have {$count} threads remaining to convert, do them in steps of {$limitDropdown}
<br /><br /> <br /><br />
<form method='post'>
<input class='button' type='submit' name='move_thread_data' value='Continue thread data move' /> <input class='button' type='submit' name='move_thread_data' value='Continue thread data move' />
</form> </form>
"; ";
@@ -627,7 +629,7 @@ function step9()
$tmp = array(); $tmp = array();
$tmp['thread_options'] = serialize($opts); $tmp['thread_options'] = serialize($opts);
$tmp['WHERE'] = 'thread_id = '.$threadId; $tmp['WHERE'] = 'thread_id = '.$threadId;
$tmp['_FIELD_TYPES']['thread_options'] = 'escape'; // $tmp['_FIELD_TYPES']['thread_options'] = 'escape';
$e107->sql->db_Update('forum_thread', $tmp); $e107->sql->db_Update('forum_thread', $tmp);
} }
} }
@@ -794,7 +796,12 @@ class forumUpgrade
{ {
var $newVersion = '2.0'; var $newVersion = '2.0';
var $error = array(); var $error = array();
var $updateInfo; public $updateInfo;
public function __initialize()
{
$this->updateInfo['lastThread'] = 0;
}
function forumUpgrade() function forumUpgrade()
{ {
@@ -908,10 +915,13 @@ class forumUpgrade
$thread['thread_active'] = 1; $thread['thread_active'] = 1;
} }
$thread['_FIELD_TYPES'] = $forum->fieldTypes['forum_thread']; // $thread['_FIELD_TYPES'] = $forum->fieldTypes['forum_thread'];
$thread['_FIELD_TYPES']['thread_name'] = 'escape'; //use escape to prevent double entities // $thread['_FIELD_TYPES']['thread_name'] = 'escape'; //use escape to prevent double entities
return $e107->sql->db_Insert('forum_thread', $thread); $result = $e107->sql->db_Insert('forum_thread', $thread);
return $result;
// return $e107->sql->db_Insert('forum_thread', $thread);
// print_a($thread); // print_a($thread);
} }
@@ -932,10 +942,14 @@ class forumUpgrade
$newPost['post_user_anon'] = $userInfo['anon_name']; $newPost['post_user_anon'] = $userInfo['anon_name'];
$newPost['post_ip'] = $userInfo['user_ip']; $newPost['post_ip'] = $userInfo['user_ip'];
$newPost['_FIELD_TYPES'] = $forum->fieldTypes['forum_post']; // $newPost['_FIELD_TYPES'] = $forum->fieldTypes['forum_post'];
$newPost['_FIELD_TYPES']['post_entry'] = 'escape'; //use escape to prevent double entities // $newPost['_FIELD_TYPES']['post_entry'] = 'escape'; //use escape to prevent double entities
// print_a($newPost); // print_a($newPost);
return $e107->sql->db_Insert('forum_post', $newPost); // exit;
$result =$e107->sql->db_Insert('forum_post', $newPost);
// exit;
return $result;
} }
function getUserInfo(&$info) function getUserInfo(&$info)