The following errors have occured. These issues must be resolved if you ever want to enable attachment or image uploading in your forums. If you do not ever plan on enabling this setting in your forum, you may click the 'skip' button
";
foreach($f->error['attach'] as $e)
{
$text .= '** '.$e.' ';
}
$text .= "
";
}
else
{
$text = "Attachment and attachment/thumb directories are writable
";
}
$e107->ns->tablerender('Attachment directory permissions', $text);
}
}
function step2()
{
$e107 = e107::getInstance();
if(!isset($_POST['create_tables']))
{
$text = "
This step will create the new forum_thread, forum_post, and forum_attach tables. It will also create a forum_new table that will become the 'real' forum table once the data from the current table is migrated.
Creation of table(s) failed. You can not continue until these are create successfully!
";
}
else
{
$text .= "
";
}
$e107->ns->tablerender('Step 2: Forum table creation', $text);
}
function step3()
{
$e107 = e107::getInstance();
$stepCaption = 'Step 3: Extended user field creation';
if(!isset($_POST['create_extended']))
{
$text = "
This step will create the new extended user fields required for the new forum code:
* user_plugin_forum_posts (to track number of posts for each user)
* user_plugin_forum_viewed (to track threads viewed by each user
Creation of extended field(s) failed. You can not continue until these are create successfully!
';
}
else
{
$text .= "
";
}
$e107->ns->tablerender($stepCaption, $text);
}
function step4()
{
$e107 = e107::getInstance();
$stepCaption = 'Step 4: Move user specific forum data';
if(!isset($_POST['move_user_data']))
{
$text = "
This step will move the user_viewed data from user table into the user extended table.
The user_forum field data will not be moved, as it will be recalculated later.
Depending on the size of your user table, this step could take a while.
";
if($viewed != '')
{
$ue->user_extended_setvalue($userId, 'plugin_forum_viewed', mysql_real_escape_string($viewed));
$result['viewcount']++;
}
if(is_array($trackList) && count($trackList))
{
foreach($trackList as $threadId)
{
$result['trackcount']++;
$threadId = (int)$threadId;
if($threadId > 0)
{
$tmp = array();
$tmp['track_userid'] = $userId;
$tmp['track_thread'] = $threadId;
$tmp['_FIELD_TYPES']['track_userid'] = 'int';
$tmp['_FIELD_TYPES']['track_thread'] = 'int';
$e107->sql->db_Insert('forum_track', $tmp);
}
}
}
}
}
$text .= "
User data move results:
Number of users processed: {$result['usercount']}
Number of viewed data processed: {$result['viewcount']}
Number of tracked records added: {$result['trackcount']}
";
$e107->ns->tablerender($stepCaption, $text);
}
function step5()
{
$e107 = e107::getInstance();
$stepCaption = 'Step 5: Migrate forum data';
if(!isset($_POST['move_forum_data']))
{
$text = "
This step will copy all of your forum configuration from the `forum` table into the `forum_new` table.
Once the information is successfully copied, the existing 0.7 forum table will be renamed `forum_old` and the newly created `forum_new` table will be renamed `forum`.
";
$e107->ns->tablerender($stepCaption, $text);
}
}
function step7()
{
$e107 = e107::getInstance();
$stepCaption = 'Step 7: Calculate user post counts';
if(!isset($_POST['calculate_usercounts']))
{
$text = "
This step will calculate post count information for all users, as well as recount all for thread and reply counts.
";
$e107->ns->tablerender($stepCaption, $text);
return;
}
global $forum;
require_once(e_HANDLER.'user_extended_class.php');
$ue = new e107_user_extended;
$counts = $forum->getUserCounts();
foreach($counts as $uid => $count)
{
$ue->user_extended_setvalue($uid, 'user_plugin_forum_posts', $count, 'int');
}
$forum->forumUpdateCounts('all', true);
// var_dump($counts);
$text .= "
Successfully recalculated forum posts for ".count($counts)." users.
";
$e107->ns->tablerender($stepCaption, $text);
}
function step8()
{
$e107 = e107::getInstance();
$stepCaption = 'Step 8: Calculate last post information';
if(!isset($_POST['calculate_lastpost']))
{
$text = "
This step will recalculate all thread and forum lastpost information
";
$e107->ns->tablerender($stepCaption, $text);
return;
}
global $forum;
$forum->forumUpdateLastpost('forum', 'all', true);
// $forum->forumUpdateLastpost('thread', 84867);
$text .= "
Successfully recalculated lastpost information for all forums and threads.
";
$e107->ns->tablerender($stepCaption, $text);
}
function step9()
{
$e107 = e107::getInstance();
$stepCaption = 'Step 9: Migrate poll information';
if(!isset($_POST['migrate_polls']))
{
$text = "
This step will recalculate all poll information that has been entered in the forums.
";
$e107->ns->tablerender($stepCaption, $text);
return;
}
$qry = "
SELECT t.thread_id, p.poll_id FROM `#polls` AS p
LEFT JOIN `#forum_thread` AS t ON t.thread_id = p.poll_datestamp
WHERE t.thread_id IS NOT NULL
";
if($e107->sql->db_Select_gen($qry))
{
while($row = $e107->sql->db_Fetch(MYSQL_ASSOC))
{
$threadList[] = $row['thread_id'];
}
foreach($threadList as $threadId)
{
if($e107->sql->db_Select('forum_thread', 'thread_options', 'thread_id = '.$threadId, 'default', true))
{
$row = $e107->sql->db_Fetch(MYSQL_ASSOC);
if($row['thread_options'])
{
$opts = unserialize($row['thread_options']);
$opts['poll'] = 1;
}
else
{
$opts = array('poll' => 1);
}
$tmp = array();
$tmp['thread_options'] = serialize($opts);
$tmp['WHERE'] = 'thread_id = '.$threadId;
$tmp['_FIELD_TYPES']['thread_options'] = 'escape';
$e107->sql->db_Update('forum_thread', $tmp);
}
}
}
else
{
$text = 'No threads found! ';
}
$text .= "
Successfully migrated forum poll information for ".count($threadList)." thread poll(s).
";
$e107->ns->tablerender($stepCaption, $text);
}
function step10()
{
$e107 = e107::getInstance();
global $f;
$stepCaption = 'Step 9: Migrate forum attachments';
if(!isset($_POST['migrate_attachments']))
{
$text = "
This step will migrate all forum attachment information.
All files will be moved from the e107_files/public directory into the e107_plugins/forum/attachment directory and related posts will be updated accordingly.