mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 12:20:44 +02:00
Forum upgrade improvements. Tested and appears to be functional.
This commit is contained in:
@@ -1091,7 +1091,8 @@ class e_navigation
|
|||||||
|
|
||||||
$rid = str_replace(array(' ', '_'), '-', $act).($id ? "-{$id}" : '');
|
$rid = str_replace(array(' ', '_'), '-', $act).($id ? "-{$id}" : '');
|
||||||
|
|
||||||
if (($active_page == $act && !is_numeric($act))|| (str_replace("?", "", e_PAGE.e_QUERY) == str_replace("?", "", $act)))
|
//XXX && !is_numeric($act) ???
|
||||||
|
if (($active_page == $act)|| (str_replace("?", "", e_PAGE.e_QUERY) == str_replace("?", "", $act)))
|
||||||
{
|
{
|
||||||
$temp = $tmpl['button_active'.$kpost];
|
$temp = $tmpl['button_active'.$kpost];
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,11 @@ class forum_setup
|
|||||||
*/
|
*/
|
||||||
function upgrade_required()
|
function upgrade_required()
|
||||||
{
|
{
|
||||||
return false; // true to trigger an upgrade alert, and false to not.
|
if(!e107::getDb()->field('forum','forum_thread'))
|
||||||
|
{
|
||||||
|
return true; // true to trigger an upgrade alert, and false to not.
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -57,7 +61,7 @@ class forum_setup
|
|||||||
{
|
{
|
||||||
//Redirect upgrade to customized upgrade routine
|
//Redirect upgrade to customized upgrade routine
|
||||||
|
|
||||||
// e107::getRedirect()->redirect(e_PLUGIN.'forum/forum_update.php');
|
e107::getRedirect()->redirect(e_PLUGIN.'forum/forum_update.php');
|
||||||
|
|
||||||
//header('Location: '.e_PLUGIN.'forum/forum_update.php');
|
//header('Location: '.e_PLUGIN.'forum/forum_update.php');
|
||||||
}
|
}
|
||||||
|
@@ -95,29 +95,32 @@ function step1()
|
|||||||
}
|
}
|
||||||
$text .= "
|
$text .= "
|
||||||
<br />
|
<br />
|
||||||
<form method='post'>
|
<form method='post' action='".e_SELF."?step=2'>
|
||||||
<input class='button' type='submit' name='retest_attach' value='Retest Permissions' />
|
<input class='btn' type='submit' name='retest_attach' value='Retest Permissions' />
|
||||||
|
|
||||||
<input class='button' type='submit' name='skip_attach' value='Skip - I understand the risks' />
|
<input class='btn btn-success' type='submit' name='skip_attach' value='Skip - I understand the risks' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$text = "Attachment and attachment/thumb directories are writable
|
$mes->addSuccess("Attachment and attachment/thumb directories are writable");
|
||||||
<br /><br />
|
|
||||||
<form method='post'>
|
$text = "<form method='post' action='".e_SELF."?step=2'>
|
||||||
<input class='button' type='submit' name='nextStep[2]' value='Proceed to step 2' />
|
<input class='btn btn-success' type='submit' name='nextStep[2]' value='Proceed to step 2' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
$e107->ns->tablerender('Attachment directory permissions', $text);
|
$e107->ns->tablerender('Step 1: Attachment directory permissions', $mes->render(). $text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function step2()
|
function step2()
|
||||||
{
|
{
|
||||||
$e107 = e107::getInstance();
|
$e107 = e107::getInstance();
|
||||||
|
$mes = e107::getMessage();
|
||||||
|
$ns = e107::getRender();
|
||||||
|
|
||||||
if(!isset($_POST['create_tables']))
|
if(!isset($_POST['create_tables']))
|
||||||
{
|
{
|
||||||
$text = "
|
$text = "
|
||||||
@@ -127,48 +130,47 @@ function step2()
|
|||||||
<input class='button' type='submit' name='create_tables' value='Proceed with table creation' />
|
<input class='button' type='submit' name='create_tables' value='Proceed with table creation' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
$e107->ns->tablerender('Step 2: Forum table creation', $text);
|
$ns->tablerender('Step 2: Forum table creation', $text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME - use db_verify. ??
|
||||||
require_once(e_HANDLER.'db_table_admin_class.php');
|
require_once(e_HANDLER.'db_table_admin_class.php');
|
||||||
$db = new db_table_admin;
|
$db = new db_table_admin;
|
||||||
|
|
||||||
$tabList = array('forum' => 'forum_new'); // , 'forum_thread' => '', 'forum_post' => '', 'forum_track' => ''
|
$tabList = array('forum' => 'forum_new' , 'forum_thread' => '', 'forum_post' => '', 'forum_track' => '' ); //
|
||||||
$ret = '';
|
$ret = '';
|
||||||
$failed = false;
|
$failed = false;
|
||||||
$text = '';
|
$text = '';
|
||||||
foreach($tabList as $name => $rename)
|
foreach($tabList as $name => $rename)
|
||||||
{
|
{
|
||||||
$text .= 'Creating table '.($rename ? $rename : $name).' -> ';
|
$message = 'Creating table '.($rename ? $rename : $name);
|
||||||
|
|
||||||
$result = $db->createTable(e_PLUGIN.'forum/forum_sql.php', $name, true, $rename);
|
$result = $db->createTable(e_PLUGIN.'forum/forum_sql.php', $name, true, $rename);
|
||||||
if($result === true)
|
if($result === true)
|
||||||
{
|
{
|
||||||
$text .= 'Success <br />';
|
$mes->addSuccess($message);
|
||||||
|
// $text .= 'Success <br />';
|
||||||
}
|
}
|
||||||
elseif($result !== true)
|
elseif($result !== true)
|
||||||
{
|
{
|
||||||
$text .= 'Failed <br />';
|
// $text .= 'Failed <br />';
|
||||||
|
$mes->addError($message);
|
||||||
$failed = true;
|
$failed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($failed)
|
if($failed)
|
||||||
{
|
{
|
||||||
$text .= "
|
$mes->addError("Creation of table(s) failed. You can not continue until these are created successfully!");
|
||||||
<br /><br />
|
|
||||||
Creation of table(s) failed. You can not continue until these are create successfully!
|
|
||||||
";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$text .= "
|
$text = "<form method='post' action='".e_SELF."?step=4'>
|
||||||
<br /><br />
|
<input class='btn button' type='submit' name='nextStep[4]' value='Proceed to step 3' />
|
||||||
<form method='post'>
|
</form>";
|
||||||
<input class='button' type='submit' name='nextStep[4]' value='Proceed to step 3' />
|
|
||||||
</form>
|
|
||||||
";
|
|
||||||
}
|
}
|
||||||
$e107->ns->tablerender('Step 2: Forum table creation', $text);
|
$ns->tablerender('Step 2: Forum table creation', $mes->render(). $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -237,6 +239,9 @@ function step4()
|
|||||||
{
|
{
|
||||||
global $pref;
|
global $pref;
|
||||||
$e107 = e107::getInstance();
|
$e107 = e107::getInstance();
|
||||||
|
$mes = e107::getMessage();
|
||||||
|
$ns = e107::getRender();
|
||||||
|
|
||||||
$stepCaption = 'Step 4: Move user specific forum data and forum prefs';
|
$stepCaption = 'Step 4: Move user specific forum data and forum prefs';
|
||||||
if(!isset($_POST['move_user_data']))
|
if(!isset($_POST['move_user_data']))
|
||||||
{
|
{
|
||||||
@@ -250,7 +255,7 @@ function step4()
|
|||||||
<input class='button' type='submit' name='move_user_data' value='Proceed with user data move' />
|
<input class='button' type='submit' name='move_user_data' value='Proceed with user data move' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
$e107->ns->tablerender($stepCaption, $text);
|
$ns->tablerender($stepCaption, $text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,8 +277,9 @@ function step4()
|
|||||||
'reported_post_email', 'email_notify', 'email_notify_on'
|
'reported_post_email', 'email_notify', 'email_notify_on'
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($forumPrefList as $_fp) {
|
foreach($forumPrefList as $_fp)
|
||||||
echo "converting $_fp to $_fp<br />";
|
{
|
||||||
|
$mes->addDebug( "converting $_fp to $_fp" );
|
||||||
$old_prefs[$_fp] = $coreConfig->get($_fp);
|
$old_prefs[$_fp] = $coreConfig->get($_fp);
|
||||||
$coreConfig->remove($_fp);
|
$coreConfig->remove($_fp);
|
||||||
}
|
}
|
||||||
@@ -287,12 +293,12 @@ function step4()
|
|||||||
'trackcount' => 0
|
'trackcount' => 0
|
||||||
);
|
);
|
||||||
$db = new db;
|
$db = new db;
|
||||||
if($db->db_Select('user', 'user_id, user_viewed, user_realm',"user_viewed != '' OR user_realm != ''"))
|
if($db->select('user', 'user_id, user_viewed, user_realm',"user_viewed != '' OR user_realm != ''"))
|
||||||
{
|
{
|
||||||
require_once(e_HANDLER.'user_extended_class.php');
|
require_once(e_HANDLER.'user_extended_class.php');
|
||||||
$ue = new e107_user_extended;
|
$ue = new e107_user_extended;
|
||||||
|
|
||||||
while($row = $db->db_Fetch(MYSQL_ASSOC))
|
while($row = $db->fetch(MYSQL_ASSOC))
|
||||||
{
|
{
|
||||||
$result['usercount']++;
|
$result['usercount']++;
|
||||||
$userId = (int)$row['user_id'];
|
$userId = (int)$row['user_id'];
|
||||||
@@ -340,44 +346,50 @@ function step4()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$text .= "
|
$mes->addSuccess( "User data move results:
|
||||||
User data move results:<br />
|
<ul>
|
||||||
Number of users processed: {$result['usercount']} <br />
|
<li>Number of users processed: {$result['usercount']} </li>
|
||||||
Number of viewed data processed: {$result['viewcount']} <br />
|
<li>Number of viewed data processed: {$result['viewcount']} </li>
|
||||||
Number of tracked records added: {$result['trackcount']} <br />
|
<li>Number of tracked records added: {$result['trackcount']} </li>
|
||||||
<br /><br />
|
</ul>
|
||||||
<form method='post'>
|
");
|
||||||
<input class='button' type='submit' name='nextStep[5]' value='Proceed to step 5' />
|
|
||||||
</form>
|
|
||||||
";
|
|
||||||
|
|
||||||
$e107->ns->tablerender($stepCaption, $text);
|
$text = "<form method='post' action='".e_SELF."?step=5'>
|
||||||
|
<input class='button' type='submit' name='nextStep[5]' value='Proceed to step 5' />
|
||||||
|
</form>";
|
||||||
|
|
||||||
|
$ns->tablerender($stepCaption, $mes->render().$text);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function step5()
|
function step5()
|
||||||
{
|
{
|
||||||
$e107 = e107::getInstance();
|
$e107 = e107::getInstance();
|
||||||
|
|
||||||
|
$sql = e107::getDb();
|
||||||
|
$ns = e107::getRender();
|
||||||
|
$mes = e107::getMessage();
|
||||||
|
|
||||||
$stepCaption = 'Step 5: Migrate forum data';
|
$stepCaption = 'Step 5: Migrate forum data';
|
||||||
if(!isset($_POST['move_forum_data']))
|
if(!isset($_POST['move_forum_data']))
|
||||||
{
|
{
|
||||||
$text = "
|
$mes->addInfo("This step will copy all of your forum configuration from the `forum` table into the `forum_new` table.<br />
|
||||||
This step will copy all of your forum configuration from the `forum` table into the `forum_new` table.<br /><br />
|
|
||||||
Once the information is successfully copied, the existing 1.0 forum table will be renamed `forum_old` and the newly created `forum_new` table will be renamed `forum`.<br />
|
Once the information is successfully copied, the existing 1.0 forum table will be renamed `forum_old` and the newly created `forum_new` table will be renamed `forum`.<br />
|
||||||
<br /><br />
|
");
|
||||||
|
$text = "
|
||||||
<form method='post'>
|
<form method='post'>
|
||||||
<input class='button' type='submit' name='move_forum_data' value='Proceed with forum data move' />
|
<input class='button' type='submit' name='move_forum_data' value='Proceed with forum data move' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
$e107->ns->tablerender($stepCaption, $text);
|
$ns->tablerender($stepCaption, $mes->render().$text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$counts = array('parens' => 0, 'forums' => 0, 'subs' => 0);
|
$counts = array('parens' => 0, 'forums' => 0, 'subs' => 0); //XXX Typo on 'parents' ?
|
||||||
|
|
||||||
if($e107->sql->db_Select('forum'))
|
if($sql->select('forum'))
|
||||||
{
|
{
|
||||||
$forumList = $e107->sql->db_getList();
|
$forumList = $sql->db_getList();
|
||||||
foreach($forumList as $forum)
|
foreach($forumList as $forum)
|
||||||
{
|
{
|
||||||
if($forum['forum_parent'] == 0)
|
if($forum['forum_parent'] == 0)
|
||||||
@@ -397,33 +409,32 @@ function step5()
|
|||||||
$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);
|
$sql->insert('forum_new', $tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$mes->addInfo ( "
|
||||||
|
Forum data move results:
|
||||||
|
<ul>
|
||||||
|
<li>Number of forum parents processed: {$counts['parents']} </li>
|
||||||
|
<li>Number of forums processed: {$counts['forums']} </li>
|
||||||
|
<li>Number of sub forums processed: {$counts['subs']} </li>
|
||||||
|
</ul>
|
||||||
|
");
|
||||||
|
|
||||||
|
$result = $sql->gen('RENAME TABLE `#forum` TO `#forum_old` ') ? e_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
|
||||||
|
$mes->add("Renaming forum to forum_old",$result);
|
||||||
|
|
||||||
|
$result = $sql->gen('RENAME TABLE `#forum_new` TO `#forum` ') ? e_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
|
||||||
|
$mes->add("Renaming forum_new to forum",$result);
|
||||||
|
|
||||||
|
|
||||||
$text = "
|
$text = "
|
||||||
Forum data move results:<br />
|
<form method='post' action='".e_SELF."?step=6'>
|
||||||
Number of forum parents processed: {$counts['parents']} <br />
|
|
||||||
Number of forums processed: {$counts['forums']} <br />
|
|
||||||
Number of sub forums processed: {$counts['subs']} <br />
|
|
||||||
<br /><br />
|
|
||||||
";
|
|
||||||
|
|
||||||
$result = $e107->sql->db_Select_gen('RENAME TABLE `#forum` TO `#forum_old` ');
|
|
||||||
$text .= "Rename forum to forum_old -> ".($result ? 'Passed' : 'Failed!');
|
|
||||||
$text .= '<br />';
|
|
||||||
|
|
||||||
$result = $e107->sql->db_Select_gen('RENAME TABLE `#forum_new` TO `#forum` ');
|
|
||||||
$text .= "Rename forum_new to forum -> ".($result ? 'Passed' : 'Failed!');
|
|
||||||
$text .= '<br />';
|
|
||||||
|
|
||||||
$text .= "
|
|
||||||
<br /><br />
|
|
||||||
<form method='post'>
|
|
||||||
<input class='button' type='submit' name='nextStep[6]' value='Proceed to step 6' />
|
<input class='button' type='submit' name='nextStep[6]' value='Proceed to step 6' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
|
|
||||||
$e107->ns->tablerender($stepCaption, $text);
|
$ns->tablerender($stepCaption, $mes->render(). $text);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -432,6 +443,10 @@ function step6()
|
|||||||
{
|
{
|
||||||
global $f;
|
global $f;
|
||||||
$e107 = e107::getInstance();
|
$e107 = e107::getInstance();
|
||||||
|
$ns = e107::getRender();
|
||||||
|
$mes = e107::getMessage();
|
||||||
|
$sql = e107::getDb();
|
||||||
|
|
||||||
$stepCaption = 'Step 6: Thread and post data';
|
$stepCaption = 'Step 6: Thread and post data';
|
||||||
$threadLimit = varset($_POST['threadLimit'], 1000);
|
$threadLimit = varset($_POST['threadLimit'], 1000);
|
||||||
$lastThread = varset($f->updateInfo['lastThread'], 0);
|
$lastThread = varset($f->updateInfo['lastThread'], 0);
|
||||||
@@ -439,7 +454,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 = $sql->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'>
|
||||||
@@ -456,11 +471,11 @@ function step6()
|
|||||||
<input class='button' type='submit' name='move_thread_data' value='Begin thread data move' />
|
<input class='button' type='submit' name='move_thread_data' value='Begin thread data move' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
$e107->ns->tablerender($stepCaption, $text);
|
$ns->tablerender($stepCaption, $mes->render(). $text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$count = $e107->sql->db_Count('forum_t', '(*)', "WHERE thread_parent=0 AND thread_id>{$lastThread}");
|
$count = $sql->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";
|
||||||
@@ -475,10 +490,10 @@ function step6()
|
|||||||
ORDER BY thread_id ASC
|
ORDER BY thread_id ASC
|
||||||
LIMIT 0, {$threadLimit}
|
LIMIT 0, {$threadLimit}
|
||||||
";
|
";
|
||||||
if($e107->sql->db_Select_gen($qry))
|
if($sql->gen($qry))
|
||||||
{
|
{
|
||||||
$postCount = 0;
|
$postCount = 0;
|
||||||
$threadList = $e107->sql->db_getList();
|
$threadList = $sql->db_getList();
|
||||||
$text = '';
|
$text = '';
|
||||||
foreach($threadList as $t)
|
foreach($threadList as $t)
|
||||||
{
|
{
|
||||||
@@ -500,7 +515,7 @@ function step6()
|
|||||||
$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 = $sql->count('forum_t', '(*)', "WHERE thread_parent = 0 AND thread_id > {$f->updateInfo['lastThread']}");
|
||||||
if($count)
|
if($count)
|
||||||
{
|
{
|
||||||
$limitDropdown = createThreadLimitDropdown($count);
|
$limitDropdown = createThreadLimitDropdown($count);
|
||||||
@@ -508,10 +523,10 @@ function step6()
|
|||||||
<form method='post'>
|
<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 />
|
||||||
<input class='button' type='submit' name='move_thread_data' value='Continue thread data move' />
|
<input class='btn btn-success' type='submit' name='move_thread_data' value='Continue thread data move' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
$e107->ns->tablerender($stepCaption, $text);
|
$ns->tablerender($stepCaption, $mes->render(). $text);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -524,14 +539,12 @@ function step6()
|
|||||||
}
|
}
|
||||||
if($done)
|
if($done)
|
||||||
{
|
{
|
||||||
$text .= "
|
$mes->addSuccess("Thread migration is complete!!");
|
||||||
Thread migration is complete!!
|
$text = "<form method='post' action='".e_SELF."?step=7'>
|
||||||
<br /><br />
|
|
||||||
<form method='post'>
|
|
||||||
<input class='button' type='submit' name='nextStep[7]' value='Proceed to step 7' />
|
<input class='button' type='submit' name='nextStep[7]' value='Proceed to step 7' />
|
||||||
</form>
|
</form>";
|
||||||
";
|
|
||||||
$e107->ns->tablerender($stepCaption, $text);
|
$ns->tablerender($stepCaption, $mes->render(). $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -571,7 +584,7 @@ function step7()
|
|||||||
$text .= "
|
$text .= "
|
||||||
Successfully recalculated forum posts for ".count($counts)." users.
|
Successfully recalculated forum posts for ".count($counts)." users.
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<form method='post'>
|
<form method='post' action='".e_SELF."?step=8'>
|
||||||
<input class='button' type='submit' name='nextStep[8]' value='Proceed to step 8' />
|
<input class='button' type='submit' name='nextStep[8]' value='Proceed to step 8' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
@@ -606,7 +619,7 @@ function step8()
|
|||||||
$text .= "
|
$text .= "
|
||||||
Successfully recalculated lastpost information for all forums and threads.
|
Successfully recalculated lastpost information for all forums and threads.
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<form method='post'>
|
<form method='post' action='".e_SELF."?step=9'>
|
||||||
<input class='button' type='submit' name='nextStep[9]' value='Proceed to step 9' />
|
<input class='button' type='submit' name='nextStep[9]' value='Proceed to step 9' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
@@ -671,7 +684,7 @@ function step9()
|
|||||||
$text .= "
|
$text .= "
|
||||||
Successfully migrated forum poll information for ".count($threadList)." thread poll(s).
|
Successfully migrated forum poll information for ".count($threadList)." thread poll(s).
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<form method='post'>
|
<form method='post' action='".e_SELF."?step=10'>
|
||||||
<input class='button' type='submit' name='nextStep[10]' value='Proceed to step 10' />
|
<input class='button' type='submit' name='nextStep[10]' value='Proceed to step 10' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
@@ -681,6 +694,9 @@ function step9()
|
|||||||
function step10()
|
function step10()
|
||||||
{
|
{
|
||||||
$e107 = e107::getInstance();
|
$e107 = e107::getInstance();
|
||||||
|
$sql = e107::getDb();
|
||||||
|
$ns = e107::getRender();
|
||||||
|
|
||||||
global $f;
|
global $f;
|
||||||
$stepCaption = 'Step 10: Migrate forum attachments';
|
$stepCaption = 'Step 10: Migrate forum attachments';
|
||||||
|
|
||||||
@@ -695,7 +711,7 @@ function step10()
|
|||||||
<input class='button' type='submit' name='migrate_attachments' value='Proceed with attachment migration' />
|
<input class='button' type='submit' name='migrate_attachments' value='Proceed with attachment migration' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
$e107->ns->tablerender($stepCaption, $text);
|
$ns->tablerender($stepCaption, $text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -703,15 +719,18 @@ function step10()
|
|||||||
SELECT post_id, post_entry FROM `#forum_post`
|
SELECT post_id, post_entry FROM `#forum_post`
|
||||||
WHERE post_entry REGEXP '_[[:digit:]]+_FT'
|
WHERE post_entry REGEXP '_[[:digit:]]+_FT'
|
||||||
";
|
";
|
||||||
if($e107->sql->db_Select_gen($qry, true))
|
|
||||||
|
if($sql->gen($qry))
|
||||||
{
|
{
|
||||||
while($row = $e107->sql->db_Fetch(MYSQL_ASSOC))
|
while($row = $sql->fetch(MYSQL_ASSOC))
|
||||||
{
|
{
|
||||||
$postList[] = $row;
|
$postList[] = $row;
|
||||||
}
|
}
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$pcount = 0;
|
$pcount = 0;
|
||||||
$f->log("Found ".count($postList). " posts with attachments");
|
$f->log("Found ".count($postList). " posts with attachments");
|
||||||
|
|
||||||
|
//XXX Run post through $tp->toHtml() and then use $tp->getTag() to find images or files.?
|
||||||
foreach($postList as $post)
|
foreach($postList as $post)
|
||||||
{
|
{
|
||||||
// echo htmlentities($post['post_entry'])."<br />";
|
// echo htmlentities($post['post_entry'])."<br />";
|
||||||
@@ -876,7 +895,7 @@ function step10()
|
|||||||
$info['WHERE'] = 'post_id = '.$post['post_id'];
|
$info['WHERE'] = 'post_id = '.$post['post_id'];
|
||||||
$info['post_attachments'] = implode(',', $newValues);
|
$info['post_attachments'] = implode(',', $newValues);
|
||||||
// print_a($info);
|
// print_a($info);
|
||||||
$e107->sql->db_Update('forum_post', $info);
|
$sql->db_Update('forum_post', $info);
|
||||||
}
|
}
|
||||||
// echo $post['thread_thread']."<br />";
|
// echo $post['thread_thread']."<br />";
|
||||||
// print_a($newValues);
|
// print_a($newValues);
|
||||||
@@ -895,7 +914,7 @@ function step10()
|
|||||||
$text .= "
|
$text .= "
|
||||||
Successfully migrated forum attachment information for ".count($postList)." post(s).
|
Successfully migrated forum attachment information for ".count($postList)." post(s).
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<form method='post'>
|
<form method='post' action='".e_SELF."?step=11'>
|
||||||
<input class='button' type='submit' name='nextStep[11]' value='Proceed to step 11' />
|
<input class='button' type='submit' name='nextStep[11]' value='Proceed to step 11' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
@@ -956,7 +975,7 @@ function step11()
|
|||||||
Successfully removed {$success} orphaned files <br />
|
Successfully removed {$success} orphaned files <br />
|
||||||
{$failText}
|
{$failText}
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<form method='post'>
|
<form method='post' action='".e_SELF."?step=12'>
|
||||||
<input class='button' type='submit' name='nextStep[12]' value='Proceed to step 12' />
|
<input class='button' type='submit' name='nextStep[12]' value='Proceed to step 12' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
@@ -992,7 +1011,7 @@ function step11()
|
|||||||
$text .= "
|
$text .= "
|
||||||
There were no orphaned files found <br />
|
There were no orphaned files found <br />
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<form method='post'>
|
<form method='post' action='".e_SELF."?step=12'>
|
||||||
<input class='button' type='submit' name='nextStep[12]' value='Proceed to step 12' />
|
<input class='button' type='submit' name='nextStep[12]' value='Proceed to step 12' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
@@ -1003,9 +1022,14 @@ function step11()
|
|||||||
|
|
||||||
function step12()
|
function step12()
|
||||||
{
|
{
|
||||||
$e107 = e107::getInstance();
|
$sql = e107::getDb();
|
||||||
|
$ns = e107::getRender();
|
||||||
|
$mes = e107::getMessage();
|
||||||
|
|
||||||
$f = new forumUpgrade;
|
$f = new forumUpgrade;
|
||||||
|
|
||||||
$stepCaption = 'Step 12: Delete old forum data';
|
$stepCaption = 'Step 12: Delete old forum data';
|
||||||
|
|
||||||
if(!isset($_POST['delete_old']))
|
if(!isset($_POST['delete_old']))
|
||||||
{
|
{
|
||||||
$text = "
|
$text = "
|
||||||
@@ -1018,7 +1042,7 @@ function step12()
|
|||||||
<input class='button' type='submit' name='delete_old' value='Remove old forum tables' />
|
<input class='button' type='submit' name='delete_old' value='Remove old forum tables' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
$e107->ns->tablerender($stepCaption, $text);
|
$ns->tablerender($stepCaption, $text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1027,21 +1051,24 @@ function step12()
|
|||||||
"DROP TABLE `#forum_t",
|
"DROP TABLE `#forum_t",
|
||||||
"DELETE * FROM `#generic` WHERE gen_type = 'forumUpgrade'"
|
"DELETE * FROM `#generic` WHERE gen_type = 'forumUpgrade'"
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($qryArray as $qry)
|
foreach($qryArray as $qry)
|
||||||
{
|
{
|
||||||
$e107->sql->db_Select_gen($qry, true);
|
$sql->gen($qry);
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret = $f->setNewVersion();
|
$ret = $f->setNewVersion();
|
||||||
|
|
||||||
$text = "
|
$mes->addSuccess("Congratulations, the forum upgrade is now completed!<br /><br />{$ret}");
|
||||||
Congratulations, the forum upgrade is now completed!<br /><br />
|
$ns->tablerender($stepCaption,$mes->render(). $text);
|
||||||
{$ret}
|
|
||||||
<br /><br />
|
|
||||||
";
|
|
||||||
$e107->ns->tablerender($stepCaption, $text);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class forumUpgrade
|
class forumUpgrade
|
||||||
{
|
{
|
||||||
var $newVersion = '2.0';
|
var $newVersion = '2.0';
|
||||||
@@ -1069,9 +1096,10 @@ class forumUpgrade
|
|||||||
|
|
||||||
public function checkUpdateNeeded()
|
public function checkUpdateNeeded()
|
||||||
{
|
{
|
||||||
include_once(e_PLUGIN.'forum/forum_update_check.php');
|
return true;
|
||||||
$needed = update_forum_08('check');
|
// include_once(e_PLUGIN.'forum/forum_update_check.php');
|
||||||
return !$needed;
|
// $needed = update_forum_08('check');
|
||||||
|
// return !$needed;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkAttachmentDirs()
|
function checkAttachmentDirs()
|
||||||
@@ -1126,9 +1154,11 @@ class forumUpgrade
|
|||||||
|
|
||||||
function setNewVersion()
|
function setNewVersion()
|
||||||
{
|
{
|
||||||
global $pref;
|
$pref = e107::getPref();
|
||||||
$e107 = e107::getInstance();
|
$e107 = e107::getInstance();
|
||||||
$e107->sql->db_Update('plugin',"plugin_version = '{$this->newVersion}' WHERE plugin_name='Forum'", true);
|
$sql = e107::getDb();
|
||||||
|
|
||||||
|
$sql->update('plugin',"plugin_version = '{$this->newVersion}' WHERE plugin_name='Forum'");
|
||||||
$pref['plug_installed']['forum'] = $this->newVersion;
|
$pref['plug_installed']['forum'] = $this->newVersion;
|
||||||
save_prefs();
|
save_prefs();
|
||||||
return "Forum Version updated to version: {$this->newVersion} <br />";
|
return "Forum Version updated to version: {$this->newVersion} <br />";
|
||||||
@@ -1373,7 +1403,7 @@ class forumUpgrade
|
|||||||
function createThreadLimitDropdown($count)
|
function createThreadLimitDropdown($count)
|
||||||
{
|
{
|
||||||
$ret = "
|
$ret = "
|
||||||
<select name='threadLimit'>
|
<select class='tbox' name='threadLimit'>
|
||||||
";
|
";
|
||||||
$last = min($count, 10000);
|
$last = min($count, 10000);
|
||||||
if($count < 2000) {
|
if($count < 2000) {
|
||||||
@@ -1397,10 +1427,10 @@ function createThreadLimitDropdown($count)
|
|||||||
|
|
||||||
function forum_update_adminmenu()
|
function forum_update_adminmenu()
|
||||||
{
|
{
|
||||||
global $currentStep;
|
$action = 1;
|
||||||
|
|
||||||
$var[1]['text'] = '1 - Permissions';
|
$var[1]['text'] = '1 - Permissions';
|
||||||
$var[1]['link'] = '#';
|
$var[1]['link'] = e_SELF;
|
||||||
|
|
||||||
$var[2]['text'] = '2 - Create new tables';
|
$var[2]['text'] = '2 - Create new tables';
|
||||||
$var[2]['link'] = '#';
|
$var[2]['link'] = '#';
|
||||||
@@ -1436,16 +1466,10 @@ function forum_update_adminmenu()
|
|||||||
$var[12]['link'] = '#';
|
$var[12]['link'] = '#';
|
||||||
|
|
||||||
|
|
||||||
for($i=1; $i < $currentStep; $i++)
|
if(isset($_GET['step']))
|
||||||
{
|
{
|
||||||
$var[$i]['text'] = "<span style='color:green;'>{$var[$i]['text']}</span>";
|
// $action = key($_POST['nextStep']);
|
||||||
}
|
$action = intval($_GET['step']);
|
||||||
|
|
||||||
if(isset($_POST['nextStep']))
|
|
||||||
{
|
|
||||||
$tmp = array_keys($_POST['nextStep']);
|
|
||||||
$action = $tmp[0];
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
show_admin_menu('Forum Upgrade', $action, $var);
|
show_admin_menu('Forum Upgrade', $action, $var);
|
||||||
|
Reference in New Issue
Block a user