Prechádzať zdrojové kódy

! First commit of moved topic upgrades. Allows to set an expiration limit on the moved notice for auto removal, Adds ability to redirect by clicking on the moved topic notice from the topic list instead of navigating in to the moved topic message to select the link.

Signed-off-by: Spuds <[email protected]>
Spuds 12 rokov pred
rodič
commit
0b1f8df7bc

+ 7 - 4
Sources/Display.php

@@ -149,7 +149,7 @@ function Display()
 	$request = $smcFunc['db_query']('', '
 		SELECT
 			t.num_replies, t.num_views, t.locked, ms.subject, t.is_sticky, t.id_poll,
-			t.id_member_started, t.id_first_msg, t.id_last_msg, t.approved, t.unapproved_posts,
+			t.id_member_started, t.id_first_msg, t.id_last_msg, t.approved, t.unapproved_posts, t.id_redirect_topic,
 			' . ($user_info['is_guest'] ? 't.id_last_msg + 1' : 'IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1') . ' AS new_from
 			' . (!empty($modSettings['recycle_board']) && $modSettings['recycle_board'] == $board ? ', id_previous_board, id_previous_topic' : '') . '
 		FROM {db_prefix}topics AS t
@@ -168,6 +168,10 @@ function Display()
 		fatal_lang_error('not_a_topic', false);
 	$topicinfo = $smcFunc['db_fetch_assoc']($request);
 	$smcFunc['db_free_result']($request);
+	
+	// Is this a moved topic that we are redirecting to?
+	if (!empty($topicinfo['id_redirect_topic']))
+		redirectexit('topic=' . $topicinfo['id_redirect_topic'] . '.0');
 
 	$context['real_num_replies'] = $context['num_replies'] = $topicinfo['num_replies'];
 	$context['topic_first_message'] = $topicinfo['id_first_msg'];
@@ -1190,7 +1194,7 @@ function prepareDisplayContext($reset = false)
 }
 
 /**
- * Downloads an attachment or avatar, and increments the downloads.
+ * Downloads an attachment or avatar, and increments the download count.
  * It requires the view_attachments permission. (not for avatars!)
  * It disables the session parser, and clears any previous output.
  * It depends on the attachmentUploadDir setting being correct.
@@ -1422,8 +1426,7 @@ function Download()
 }
 
 /**
- * This loads an attachment's contextual data including, most importantly, its size
- *  if it is an image.
+ * This loads an attachment's contextual data including, most importantly, its size if it is an image.
  *  Pre-condition: $attachments array to have been filled with the proper attachment data, as Display() does.
  *  (@todo change this pre-condition, too fragile and error-prone.)
  *  It requires the view_attachments permission to calculate image size.

+ 12 - 3
Sources/MoveTopic.php

@@ -296,6 +296,12 @@ function MoveTopic2()
 			$txt['movetopic_auto_board'] => '[url=' . $scripturl . '?board=' . $_POST['toboard'] . '.0]' . $board_name . '[/url]',
 			$txt['movetopic_auto_topic'] => '[iurl]' . $scripturl . '?topic=' . $topic . '.0[/iurl]'
 		));
+		
+		// auto remove this MOVED redirection topic in the future?
+		$redirect_expires = !empty($_POST['redirect_expires']) ? ((int) $_POST['redirect_expires'] + time()) : 0;
+
+		// redirect to the MOVED topic from topic list?
+		$redirect_topic = isset($_POST['redirect_topic']) ? $topic : 0;
 
 		$msgOptions = array(
 			'subject' => $txt['moved'] . ': ' . $subject,
@@ -307,6 +313,8 @@ function MoveTopic2()
 			'board' => $board,
 			'lock_mode' => 1,
 			'mark_as_read' => true,
+			'redirect_expires' => $redirect_expires,
+			'redirect_topic' => $redirect_topic,
 		);
 		$posterOptions = array(
 			'id' => $user_info['id'],
@@ -384,8 +392,9 @@ function moveTopics($topics, $toBoard)
 	// Empty array?
 	if (empty($topics))
 		return;
+		
 	// Only a single topic.
-	elseif (is_numeric($topics))
+	if (is_numeric($topics))
 		$topics = array($topics);
 	$num_topics = count($topics);
 	$fromBoards = array();
@@ -710,8 +719,8 @@ function moveTopicConcurrence()
 		$request = $smcFunc['db_query']('', '
 			SELECT m.subject, b.name
 			FROM {db_prefix}topics as t
-			LEFT JOIN {db_prefix}boards AS b ON (t.id_board = b.id_board)
-			LEFT JOIN {db_prefix}messages AS m ON (t.id_first_msg = m.id_msg)
+				LEFT JOIN {db_prefix}boards AS b ON (t.id_board = b.id_board)
+				LEFT JOIN {db_prefix}messages AS m ON (t.id_first_msg = m.id_msg)
 			WHERE t.id_topic = {int:topic_id}
 			LIMIT 1',
 			array(

+ 2 - 2
Sources/RemoveTopic.php

@@ -230,9 +230,9 @@ function removeTopics($topics, $decreasePostCount = true, $ignoreRecycling = fal
 	if (empty($topics))
 		return;
 	// Only a single topic.
-	elseif (is_numeric($topics))
+	if (is_numeric($topics))
 		$topics = array($topics);
-
+		
 	// Decrease the post counts.
 	if ($decreasePostCount)
 	{

+ 38 - 0
Sources/ScheduledTasks.php

@@ -1682,4 +1682,42 @@ function scheduled_remove_temp_attachments()
 	}
 }
 
+/**
+ * Check for move topic notices that have past their best by date
+ */
+function scheduled_remove_topic_redirect() 
+{
+	global $smcFunc, $sourcedir;
+	
+	// init
+	$topics = array();
+	
+	// We will need this for lanaguage files
+	loadEssentialThemeData();
+	
+	// Find all of the old MOVE topic notices that were set to expire
+	$request = $smcFunc['db_query']('', '
+		SELECT id_topic
+		FROM {db_prefix}topics
+		WHERE redirect_expires <= {int:redirect_expires}
+			AND redirect_expires <> 0',
+		array(
+			'redirect_expires' => time(),
+		)
+	);
+	
+	while ($row = $smcFunc['db_fetch_row']($request))
+		$topics[] = $row[0];
+	$smcFunc['db_free_result']($request);
+	
+	// Zap, your gone
+	if (count($topics) > 0)
+	{
+		require_once($sourcedir . '/RemoveTopic.php');
+		removeTopics($topics, false, true);
+	}
+
+	return true;
+}
+
 ?>

+ 4 - 0
Sources/Subs-Post.php

@@ -1762,6 +1762,8 @@ function createPost(&$msgOptions, &$topicOptions, &$posterOptions)
 	$topicOptions['poll'] = isset($topicOptions['poll']) ? (int) $topicOptions['poll'] : null;
 	$topicOptions['lock_mode'] = isset($topicOptions['lock_mode']) ? $topicOptions['lock_mode'] : null;
 	$topicOptions['sticky_mode'] = isset($topicOptions['sticky_mode']) ? $topicOptions['sticky_mode'] : null;
+	$topicOptions['redirect_expires'] = isset($topicOptions['redirect_expires']) ? $topicOptions['redirect_expires'] : null;
+	$topicOptions['redirect_topic'] = isset($topicOptions['redirect_topic']) ? $topicOptions['redirect_topic'] : null;
 	$posterOptions['id'] = empty($posterOptions['id']) ? 0 : (int) $posterOptions['id'];
 	$posterOptions['ip'] = empty($posterOptions['ip']) ? $user_info['ip'] : $posterOptions['ip'];
 
@@ -1869,11 +1871,13 @@ function createPost(&$msgOptions, &$topicOptions, &$posterOptions)
 				'id_board' => 'int', 'id_member_started' => 'int', 'id_member_updated' => 'int', 'id_first_msg' => 'int',
 				'id_last_msg' => 'int', 'locked' => 'int', 'is_sticky' => 'int', 'num_views' => 'int',
 				'id_poll' => 'int', 'unapproved_posts' => 'int', 'approved' => 'int',
+ 				'redirect_expires' => 'int', 'id_redirect_topic' => 'int',
 			),
 			array(
 				$topicOptions['board'], $posterOptions['id'], $posterOptions['id'], $msgOptions['id'],
 				$msgOptions['id'], $topicOptions['lock_mode'] === null ? 0 : $topicOptions['lock_mode'], $topicOptions['sticky_mode'] === null ? 0 : $topicOptions['sticky_mode'], 0,
 				$topicOptions['poll'] === null ? 0 : $topicOptions['poll'], $msgOptions['approved'] ? 0 : 1, $msgOptions['approved'],
+				$topicOptions['redirect_expires'] === null ? 0 : $topicOptions['redirect_expires'], $topicOptions['redirect_topic'] === null ? 0 : $topicOptions['redirect_topic'],
 			),
 			array('id_topic')
 		);

+ 21 - 3
Themes/default/MoveTopic.template.php

@@ -70,11 +70,29 @@ function template_main()
 								<dd>
 									<textarea name="reason" rows="3" cols="40">', $txt['movetopic_default'], '</textarea>
 								</dd>
+								<dt>
+									<label for="redirect_topic">', $txt['movetopic_redirect'], '</label>
+								</dt>
+								<dd>
+									<input type="checkbox" name="redirect_topic" id="redirect_topic" checked="checked" class="input_check" />
+								</dd>
+								<dt>
+									', $txt['movetopic_expires'], '
+								</dt>
+								<dd>
+									<select name="redirect_expires">
+										<option value="0" selected="selected">', $txt['never'], '</option>
+										<option value="1440">', $txt['one_day'], '</option>
+										<option value="10080">', $txt['one_week'], '</option>
+										<option value="20160">', $txt['two_weeks'], '</option>
+										<option value="43200">', $txt['one_month'], '</option>
+										<option value="86400">', $txt['two_months'], '</option>
+									</select>
+								</dd>
 							</dl>
 						</fieldset>
-						<div class="righttext">
-							<input type="submit" value="', $txt['move_topic'], '" onclick="return submitThisOnce(this);" accesskey="s" class="button_submit" />
-						</div>
+						<input type="submit" value="', $txt['move_topic'], '" onclick="return submitThisOnce(this);" accesskey="s" class="button_submit" />
+						<br class="clear_right" />
 					</div>
 				</div>
 				<span class="botslice"><span></span></span>

+ 2 - 0
Themes/default/languages/ManageScheduledTasks.english.php

@@ -31,6 +31,8 @@ $txt['scheduled_task_weekly_maintenance'] = 'Weekly Maintenance';
 $txt['scheduled_task_desc_weekly_maintenance'] = 'Runs essential weekly maintenance on the forum - should not be disabled.';
 $txt['scheduled_task_paid_subscriptions'] = 'Paid Subscription Checks';
 $txt['scheduled_task_desc_paid_subscriptions'] = 'Sends out any necessary paid subscription reminders and removes expired member subscriptions.';
+$txt['scheduled_task_remove_topic_redirect'] = 'Remove MOVED: redirection topics';
+$txt['scheduled_task_desc_remove_topic_redirect'] = 'Deletes "MOVED:" topic notifications as specified when the moved notice was created.';
 
 $txt['scheduled_task_reg_starting'] = 'Starting at %1$s';
 $txt['scheduled_task_reg_repeating'] = 'repeating every %1$d %2$s';

+ 7 - 4
Themes/default/languages/index.english.php

@@ -380,7 +380,9 @@ $txt['poll_edit'] = 'Edit Poll';
 $txt['poll'] = 'Poll';
 $txt['one_day'] = '1 Day';
 $txt['one_week'] = '1 Week';
+$txt['two_weeks'] = '2 Weeks';
 $txt['one_month'] = '1 Month';
+$txt['two_months'] = '2 Months';
 $txt['forever'] = 'Forever';
 $txt['quick_login_dec'] = 'Login with username, password and session length';
 $txt['one_hour'] = '1 Hour';
@@ -490,6 +492,11 @@ $txt['moveTopic2'] = 'Change the topic\'s subject';
 $txt['moveTopic3'] = 'New subject';
 $txt['moveTopic4'] = 'Change every message\'s subject';
 $txt['move_topic_unapproved_js'] = 'Warning! This topic has not yet been approved.\\n\\nIt is not recommended that you create a redirection topic unless you intend to approve the post immediately following the move.';
+$txt['movetopic_auto_board'] = '[BOARD]';
+$txt['movetopic_auto_topic'] = '[TOPIC LINK]';
+$txt['movetopic_default'] = 'This topic has been moved to ' . $txt['movetopic_auto_board'] . ".\n\n" . $txt['movetopic_auto_topic'];
+$txt['movetopic_redirect'] = 'Redirect to the moved topic';
+$txt['movetopic_expires'] = 'Automatically remove the redirection topic';
 
 $txt['theme_template_error'] = 'Unable to load the \'%1$s\' template.';
 $txt['theme_language_error'] = 'Unable to load the \'%1$s\' language file.';
@@ -663,10 +670,6 @@ $txt['show_personal_messages'] = 'You have received one or more new personal mes
 $txt['previous_next_back'] = '&laquo; previous';
 $txt['previous_next_forward'] = 'next &raquo;';
 
-$txt['movetopic_auto_board'] = '[BOARD]';
-$txt['movetopic_auto_topic'] = '[TOPIC LINK]';
-$txt['movetopic_default'] = 'This topic has been moved to ' . $txt['movetopic_auto_board'] . ".\n\n" . $txt['movetopic_auto_topic'];
-
 $txt['upshrink_description'] = 'Shrink or expand the header.';
 
 $txt['mark_unread'] = 'Mark unread';

+ 5 - 2
other/install_2-1_mysql.sql

@@ -1614,8 +1614,9 @@ VALUES
 	(8, 0, 0, 1, 'd', 1, 'birthdayemails'),
 	(9, 0, 0, 1, 'w', 0, 'weekly_maintenance'),
 	(10, 0, 120, 1, 'd', 1, 'paid_subscriptions'),
-	(11, 0, 120, 1, 'd', 1, 'remove_temp_attachments');
-
+	(11, 0, 120, 1, 'd', 1, 'remove_temp_attachments'),
+	(12, 0, 180, 1, 'd', 1, 'remove_topic_redirect');
+	
 # --------------------------------------------------------
 
 #
@@ -1989,6 +1990,8 @@ CREATE TABLE {$db_prefix}topics (
   num_replies int(10) unsigned NOT NULL default '0',
   num_views int(10) unsigned NOT NULL default '0',
   locked tinyint(4) NOT NULL default '0',
+  redirect_expires int(10) unsigned NOT NULL default '0',
+  id_redirect_topic mediumint(8) unsigned NOT NULL default '0',
   unapproved_posts smallint(5) NOT NULL default '0',
   approved tinyint(3) NOT NULL default '1',
   PRIMARY KEY (id_topic),

+ 3 - 0
other/install_2-1_postgresql.sql

@@ -2106,6 +2106,7 @@ INSERT INTO {$db_prefix}scheduled_tasks	(id_task, next_time, time_offset, time_r
 INSERT INTO {$db_prefix}scheduled_tasks	(id_task, next_time, time_offset, time_regularity, time_unit, disabled, task) VALUES (9, 0, 0, 1, 'w', 0, 'weekly_maintenance');
 INSERT INTO {$db_prefix}scheduled_tasks	(id_task, next_time, time_offset, time_regularity, time_unit, disabled, task) VALUES (10, 0, 120, 1, 'd', 1, 'paid_subscriptions');
 INSERT INTO {$db_prefix}scheduled_tasks	(id_task, next_time, time_offset, time_regularity, time_unit, disabled, task) VALUES (11, 0, 120, 1, 'd', 1, 'remove_temp_attachments');
+INSERT INTO {$db_prefix}scheduled_tasks	(id_task, next_time, time_offset, time_regularity, time_unit, disabled, task) VALUES (12, 0, 180, 1, 'd', 1, 'remove_topic_redirect');
 
 # --------------------------------------------------------
 
@@ -2505,6 +2506,8 @@ CREATE TABLE {$db_prefix}topics (
   num_replies int NOT NULL default '0',
   num_views int NOT NULL default '0',
   locked smallint NOT NULL default '0',
+  redirect_expires int NOT NULL default '0',
+  id_redirect_topic int NOT NULL default '0',
   unapproved_posts smallint NOT NULL default '0',
   approved smallint NOT NULL default '1',
   PRIMARY KEY (id_topic)

+ 3 - 0
other/install_2-1_sqlite.sql

@@ -1757,6 +1757,7 @@ INSERT INTO {$db_prefix}scheduled_tasks	(id_task, next_time, time_offset, time_r
 INSERT INTO {$db_prefix}scheduled_tasks	(id_task, next_time, time_offset, time_regularity, time_unit, disabled, task) VALUES (9, 0, 0, 1, 'w', 0, 'weekly_maintenance');
 INSERT INTO {$db_prefix}scheduled_tasks	(id_task, next_time, time_offset, time_regularity, time_unit, disabled, task) VALUES (10, 0, 120, 1, 'd', 1, 'paid_subscriptions');
 INSERT INTO {$db_prefix}scheduled_tasks	(id_task, next_time, time_offset, time_regularity, time_unit, disabled, task) VALUES (11, 0, 120, 1, 'd', 1, 'remove_temp_attachments');
+INSERT INTO {$db_prefix}scheduled_tasks	(id_task, next_time, time_offset, time_regularity, time_unit, disabled, task) VALUES (12, 0, 180, 1, 'd', 1, 'remove_topic_redirect');
 COMMIT;
 
 # --------------------------------------------------------
@@ -2141,6 +2142,8 @@ CREATE TABLE {$db_prefix}topics (
   num_replies int NOT NULL default '0',
   num_views int NOT NULL default '0',
   locked smallint NOT NULL default '0',
+  redirect_expires int NOT NULL default '0',
+  id_redirect_topic int NOT NULL default '0',
   unapproved_posts smallint NOT NULL default '0',
   approved smallint NOT NULL default '1'
 );

+ 15 - 2
other/upgrade_2-1_mysql.sql

@@ -145,11 +145,24 @@ CHANGE `session_id` `session_id` char(64) NOT NULL;
 ---#
 
 /******************************************************************************/
---- Adding new scheduled tasts
+--- Adding support for MOVED topics enhancements
 /******************************************************************************/
----# Adding new Scheduled Task...
+---# Adding new columns to topics ..
+ALTER TABLE {$db_prefix}topics
+ADD COLUMN redirect_expires int(10) unsigned NOT NULL default '0',
+ADD COLUMN id_redirect_topic mediumint(8) unsigned NOT NULL default '0',
+---#
+
+/******************************************************************************/
+--- Adding new scheduled tasks
+/******************************************************************************/
+---# Adding new scheduled tasks
 INSERT INTO {$db_prefix}scheduled_tasks
 	(next_time, time_offset, time_regularity, time_unit, disabled, task)
 VALUES
 	(0, 120, 1, 'd', 0, 'remove_temp_attachments');
+INSERT INTO {$db_prefix}scheduled_tasks
+	(next_time, time_offset, time_regularity, time_unit, disabled, task)
+VALUES
+	(0, 180, 1, 'd', 0, 'remove_topic_redirect');
 ---#

+ 69 - 45
other/upgrade_2-1_postgresql.sql

@@ -115,35 +115,40 @@ ADD COLUMN ip_high8 smallint NOT NULL DEFAULT '0';
 ---# Changing existing columns to ban items...
 ---{
 upgrade_query("
-ALTER TABLE {$db_prefix}ban_items
-ALTER COLUMN ip_low1 type smallint,
-ALTER COLUMN ip_high1 type smallint,
-ALTER COLUMN ip_low2 type smallint,
-ALTER COLUMN ip_high2 type smallint,
-ALTER COLUMN ip_low3 type smallint,
-ALTER COLUMN ip_high3 type smallint,
-ALTER COLUMN ip_low4 type smallint,
-ALTER COLUMN ip_high4 type smallint;");
+	ALTER TABLE {$db_prefix}ban_items
+	ALTER COLUMN ip_low1 type smallint,
+	ALTER COLUMN ip_high1 type smallint,
+	ALTER COLUMN ip_low2 type smallint,
+	ALTER COLUMN ip_high2 type smallint,
+	ALTER COLUMN ip_low3 type smallint,
+	ALTER COLUMN ip_high3 type smallint,
+	ALTER COLUMN ip_low4 type smallint,
+	ALTER COLUMN ip_high4 type smallint;"
+);
+
 upgrade_query("
-ALTER TABLE {$db_prefix}ban_items
-ALTER COLUMN ip_low1 SET DEFAULT '0',
-ALTER COLUMN ip_high1 SET DEFAULT '0',
-ALTER COLUMN ip_low2 SET DEFAULT '0',
-ALTER COLUMN ip_high2 SET DEFAULT '0',
-ALTER COLUMN ip_low3 SET DEFAULT '0',
-ALTER COLUMN ip_high3 SET DEFAULT '0',
-ALTER COLUMN ip_low4 SET DEFAULT '0',
-ALTER COLUMN ip_high4 SET DEFAULT '0';");
+	ALTER TABLE {$db_prefix}ban_items
+	ALTER COLUMN ip_low1 SET DEFAULT '0',
+	ALTER COLUMN ip_high1 SET DEFAULT '0',
+	ALTER COLUMN ip_low2 SET DEFAULT '0',
+	ALTER COLUMN ip_high2 SET DEFAULT '0',
+	ALTER COLUMN ip_low3 SET DEFAULT '0',
+	ALTER COLUMN ip_high3 SET DEFAULT '0',
+	ALTER COLUMN ip_low4 SET DEFAULT '0',
+	ALTER COLUMN ip_high4 SET DEFAULT '0';"
+);
+
 upgrade_query("
-ALTER TABLE {$db_prefix}ban_items
-ALTER COLUMN ip_low1 SET NOT NULL,
-ALTER COLUMN ip_high1 SET NOT NULL,
-ALTER COLUMN ip_low2 SET NOT NULL,
-ALTER COLUMN ip_high2 SET NOT NULL,
-ALTER COLUMN ip_low3 SET NOT NULL,
-ALTER COLUMN ip_high3 SET NOT NULL,
-ALTER COLUMN ip_low4 SET NOT NULL,
-ALTER COLUMN ip_high4 SET NOT NULL;");
+	ALTER TABLE {$db_prefix}ban_items
+	ALTER COLUMN ip_low1 SET NOT NULL,
+	ALTER COLUMN ip_high1 SET NOT NULL,
+	ALTER COLUMN ip_low2 SET NOT NULL,
+	ALTER COLUMN ip_high2 SET NOT NULL,
+	ALTER COLUMN ip_low3 SET NOT NULL,
+	ALTER COLUMN ip_high3 SET NOT NULL,
+	ALTER COLUMN ip_low4 SET NOT NULL,
+	ALTER COLUMN ip_high4 SET NOT NULL;"
+);
 ---}
 ---#
 
@@ -161,38 +166,57 @@ ADD COLUMN credits varchar(255) NOT NULL DEFAULT '';
 ---# Altering the session_id columns...
 ---{
 upgrade_query("
-ALTER TABLE {$db_prefix}log_online
-ALTER COLUMN session type varchar(64);
+	ALTER TABLE {$db_prefix}log_online
+	ALTER COLUMN session type varchar(64);
 
-ALTER TABLE {$db_prefix}log_errors
-ALTER COLUMN session type char(64);
+	ALTER TABLE {$db_prefix}log_errors
+	ALTER COLUMN session type char(64);
 
-ALTER TABLE {$db_prefix}sessions
-ALTER COLUMN session_id type char(64);");
+	ALTER TABLE {$db_prefix}sessions
+	ALTER COLUMN session_id type char(64);");
+	
 upgrade_query("
-ALTER TABLE {$db_prefix}log_online
-ALTER COLUMN session SET DEFAULT '';
+	ALTER TABLE {$db_prefix}log_online
+	ALTER COLUMN session SET DEFAULT '';
 
-ALTER TABLE {$db_prefix}log_errors
-ALTER COLUMN session SET default '                                                                ';");
+	ALTER TABLE {$db_prefix}log_errors
+	ALTER COLUMN session SET default '                                                                ';");
 upgrade_query("
-ALTER TABLE {$db_prefix}log_online
-ALTER COLUMN session SET NOT NULL;
+	ALTER TABLE {$db_prefix}log_online
+	ALTER COLUMN session SET NOT NULL;
 
-ALTER TABLE {$db_prefix}log_errors
-ALTER COLUMN session SET NOT NULL;
+	ALTER TABLE {$db_prefix}log_errors
+	ALTER COLUMN session SET NOT NULL;
 
-ALTER TABLE {$db_prefix}sessions
-ALTER COLUMN session_id SET NOT NULL;");
+	ALTER TABLE {$db_prefix}sessions
+	ALTER COLUMN session_id SET NOT NULL;");
 ---}
 ---#
 
 /******************************************************************************/
---- Adding new scheduled tasts
+--- Adding support for MOVED topics enhancements
 /******************************************************************************/
----# Adding new Scheduled Task...
+---# Adding new columns to topics table
+---{
+upgrade_query("
+	ALTER TABLE {$db_prefix}topics
+	ADD COLUMN redirect_expires int NOT NULL DEFAULT '0'");
+upgrade_query("
+	ALTER TABLE {$db_prefix}topics
+	ADD COLUMN id_redirect_topic int NOT NULL DEFAULT '0'");
+---}
+---#
+
+/******************************************************************************/
+--- Adding new scheduled tasks
+/******************************************************************************/
+---# Adding new scheduled tasks
 INSERT INTO {$db_prefix}scheduled_tasks
 	(next_time, time_offset, time_regularity, time_unit, disabled, task)
 VALUES
 	(0, 120, 1, 'd', 0, 'remove_temp_attachments');
+INSERT INTO {$db_prefix}scheduled_tasks
+	(next_time, time_offset, time_regularity, time_unit, disabled, task)
+VALUES
+	(0, 180, 1, 'd', 0, 'remove_topic_redirect');
 ---#

+ 36 - 2
other/upgrade_2-1_sqlite.sql

@@ -145,11 +145,45 @@ CHANGE `session_id` `session_id` char(64) NOT NULL;
 ---#
 
 /******************************************************************************/
---- Adding new scheduled tasts
+--- Adding new columns for MOVED topic updates
 /******************************************************************************/
----# Adding new Scheduled Task...
+---# Adding new custom fields columns.
+---{
+$smcFunc['db_alter_table']('{db_prefix}topics', array(
+	'add' => array(
+		'redirect_expires' => array(
+			'name' => 'redirect_expires',
+			'null' => false,
+			'default' => '0',
+			'type' => 'int',
+			'auto' => false,
+		),
+	)
+));
+$smcFunc['db_alter_table']('{db_prefix}topics', array(
+	'add' => array(
+		'id_redirect_topic' => array(
+			'name' => 'id_redirect_topic',
+			'null' => false,
+			'default' => '0',
+			'type' => 'int',
+			'auto' => false,
+		),
+	)
+));
+---}
+---#
+
+/******************************************************************************/
+--- Adding new scheduled tasks
+/******************************************************************************/
+---# Adding new scheduled tasks
 INSERT INTO {$db_prefix}scheduled_tasks
 	(next_time, time_offset, time_regularity, time_unit, disabled, task)
 VALUES
 	(0, 120, 1, 'd', 0, 'remove_temp_attachments');
+INSERT INTO {$db_prefix}scheduled_tasks
+	(next_time, time_offset, time_regularity, time_unit, disabled, task)
+VALUES
+	(0, 180, 1, 'd', 0, 'remove_topic_redirect');
 ---#