1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-29 19:00:26 +02:00

More progress on forum upgrade

This commit is contained in:
mcfly
2008-12-23 20:48:24 +00:00
parent 61eb377350
commit 39d67c11f1
2 changed files with 133 additions and 84 deletions

View File

@@ -9,8 +9,8 @@
* Message Handler
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_class.php,v $
* $Revision: 1.33 $
* $Date: 2008-12-20 23:59:00 $
* $Revision: 1.34 $
* $Date: 2008-12-23 20:48:24 $
* $Author: mcfly_e107 $
*
*/
@@ -118,9 +118,9 @@ class e107forum
$e107 = e107::getInstance();
if(!$this->userViewed)
{
if(isset($e107->currentUser['user_plugin_forum_views']))
if(isset($e107->currentUser['user_plugin_forum_viewed']))
{
$this->userViewed = explode('.', $e107->currentUser['user_plugin_forum_viewed']);
$this->userViewed = explode(',', $e107->currentUser['user_plugin_forum_viewed']);
}
}
return (is_array($this->userViewed) && in_array($threadId, $this->userViewed));
@@ -757,12 +757,12 @@ class e107forum
}
}
function track($which, $uid, $threadId)
function track($which, $uid, $threadId, $force=false)
{
$e107 = e107::getInstance();
global $pref;
if (!varsettrue($pref['forum_track'])) { return false; }
if (!varsettrue($pref['forum_track']) && !$force) { return false; }
$threadId = (int)$threadId;
$uid = (int)$uid;

View File

@@ -9,8 +9,8 @@
* Message Handler
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_update.php,v $
* $Revision: 1.8 $
* $Date: 2008-12-20 23:59:00 $
* $Revision: 1.9 $
* $Date: 2008-12-23 20:48:24 $
* $Author: mcfly_e107 $
*
*/
@@ -412,7 +412,7 @@ function step6()
global $f;
$e107 = e107::getInstance();
$stepCaption = 'Step 6: Thread and post data';
$threadLimit = 300;
$threadLimit = 5000;
$lastThread = varset($f->updateInfo['lastThread'], 0);
if(!isset($_POST['move_thread_data']))
@@ -455,6 +455,7 @@ function step6()
$text = '';
foreach($threadList as $t)
{
set_time_limit(30);
$id = (int)$t['thread_id'];
$result = $f->migrateThread($id);
if($result === false)
@@ -483,6 +484,7 @@ function step6()
";
$e107->ns->tablerender($stepCaption, $text);
}
}
else
{
$text .= "
@@ -492,14 +494,49 @@ function step6()
<input class='button' type='submit' name='nextStep[7]' value='Proceed to step 7' />
</form>
";
$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
<br /><br />
<form method='post'>
<input class='button' type='submit' name='calculate_usercounts' value='Proceed with post count calculation' />
</form>
";
$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');
}
// var_dump($counts);
$text .= "
Successfully recalculated forum posts for ".count($counts)." users.
<br /><br />
<form method='post'>
<input class='button' type='submit' name='nextStep[8]' value='Proceed to step 8' />
</form>
";
$e107->ns->tablerender($stepCaption, $text);
}
@@ -614,8 +651,16 @@ class forumUpgrade
$userInfo = $this->getUserInfo($post['thread_user']);
$thread['thread_user'] = $userInfo['user_id'];
$thread['thread_user_anon'] = $userInfo['anon_name'];
// If thread marked as 'tracked by starter', we must convert to using forum_track table
if($thread['thread_active'] == 99 && $thread['thread_user'] > 0)
{
$forum->track('add', $thread['thread_user'], $thread['thread_id'], true);
$thread['thread_active'] = 1;
}
$thread['_FIELD_TYPES'] = $forum->fieldTypes['forum_thread'];
$thread['_FIELD_TYPES']['thread_name'] = 'escape'; //use escape to prevent double entities
return $e107->sql->db_Insert('forum_thread', $thread);
// print_a($thread);
}
@@ -671,9 +716,16 @@ class forumUpgrade
}
}
else
{
if(is_numeric($info) && $info > 0)
{
$ret['user_id'] = $info;
}
else
{
$ret['anon_name'] = 'Unknown';
}
}
return $ret;
}
@@ -713,12 +765,9 @@ function forum_update_adminmenu()
$var[9]['text'] = '9 - Migrate any attachments';
$var[9]['link'] = '#';
$var[10]['text'] = '10 - Migrate any attachments';
$var[10]['text'] = '10 - Delete old forum data';
$var[10]['link'] = '#';
$var[11]['text'] = '11 - Delete old forum data';
$var[11]['link'] = '#';
for($i=1; $i < $currentStep; $i++)
{