Code Duplication    Length = 39-39 lines in 2 locations

Sources/DbPackages-mysql.php 1 location

@@ 22-60 (lines=39) @@
19
/**
20
 * Add the file functions to the $smcFunc array.
21
 */
22
function db_packages_init()
23
{
24
	global $smcFunc, $reservedTables, $db_package_log, $db_prefix;
25
26
	if (!isset($smcFunc['db_create_table']) || $smcFunc['db_create_table'] != 'smf_db_create_table')
27
	{
28
		$smcFunc += array(
29
			'db_add_column' => 'smf_db_add_column',
30
			'db_add_index' => 'smf_db_add_index',
31
			'db_calculate_type' => 'smf_db_calculate_type',
32
			'db_change_column' => 'smf_db_change_column',
33
			'db_create_table' => 'smf_db_create_table',
34
			'db_drop_table' => 'smf_db_drop_table',
35
			'db_table_structure' => 'smf_db_table_structure',
36
			'db_list_columns' => 'smf_db_list_columns',
37
			'db_list_indexes' => 'smf_db_list_indexes',
38
			'db_remove_column' => 'smf_db_remove_column',
39
			'db_remove_index' => 'smf_db_remove_index',
40
		);
41
		$db_package_log = array();
42
	}
43
44
	// We setup an array of SMF tables we can't do auto-remove on - in case a mod writer cocks it up!
45
	$reservedTables = array('admin_info_files', 'approval_queue', 'attachments', 'ban_groups', 'ban_items',
46
		'board_permissions', 'boards', 'calendar', 'calendar_holidays', 'categories',
47
		'custom_fields', 'group_moderators', 'log_actions', 'log_activity', 'log_banned', 'log_boards',
48
		'log_digest', 'log_errors', 'log_floodcontrol', 'log_group_requests', 'log_mark_read',
49
		'log_notify', 'log_online', 'log_packages', 'log_polls', 'log_reported', 'log_reported_comments',
50
		'log_scheduled_tasks', 'log_search_messages', 'log_search_results', 'log_search_subjects',
51
		'log_search_topics', 'log_topics', 'mail_queue', 'membergroups', 'members', 'message_icons',
52
		'messages', 'moderators', 'package_servers', 'permission_profiles', 'permissions', 'personal_messages',
53
		'pm_recipients', 'poll_choices', 'polls', 'scheduled_tasks', 'sessions', 'settings', 'smileys',
54
		'themes', 'topics');
55
	foreach ($reservedTables as $k => $table_name)
56
		$reservedTables[$k] = strtolower($db_prefix . $table_name);
57
58
	// We in turn may need the extra stuff.
59
	db_extend('extra');
60
}
61
62
/**
63
 * This function can be used to create a table without worrying about schema

Sources/DbPackages-postgresql.php 1 location

@@ 22-60 (lines=39) @@
19
/**
20
 * Add the file functions to the $smcFunc array.
21
 */
22
function db_packages_init()
23
{
24
	global $smcFunc, $reservedTables, $db_package_log, $db_prefix;
25
26
	if (!isset($smcFunc['db_create_table']) || $smcFunc['db_create_table'] != 'smf_db_create_table')
27
	{
28
		$smcFunc += array(
29
			'db_add_column' => 'smf_db_add_column',
30
			'db_add_index' => 'smf_db_add_index',
31
			'db_calculate_type' => 'smf_db_calculate_type',
32
			'db_change_column' => 'smf_db_change_column',
33
			'db_create_table' => 'smf_db_create_table',
34
			'db_drop_table' => 'smf_db_drop_table',
35
			'db_table_structure' => 'smf_db_table_structure',
36
			'db_list_columns' => 'smf_db_list_columns',
37
			'db_list_indexes' => 'smf_db_list_indexes',
38
			'db_remove_column' => 'smf_db_remove_column',
39
			'db_remove_index' => 'smf_db_remove_index',
40
		);
41
		$db_package_log = array();
42
	}
43
44
	// We setup an array of SMF tables we can't do auto-remove on - in case a mod writer cocks it up!
45
	$reservedTables = array('admin_info_files', 'approval_queue', 'attachments', 'ban_groups', 'ban_items',
46
		'board_permissions', 'boards', 'calendar', 'calendar_holidays', 'categories',
47
		'custom_fields', 'group_moderators', 'log_actions', 'log_activity', 'log_banned', 'log_boards',
48
		'log_digest', 'log_errors', 'log_floodcontrol', 'log_group_requests', 'log_mark_read',
49
		'log_notify', 'log_online', 'log_packages', 'log_polls', 'log_reported', 'log_reported_comments',
50
		'log_scheduled_tasks', 'log_search_messages', 'log_search_results', 'log_search_subjects',
51
		'log_search_topics', 'log_topics', 'mail_queue', 'membergroups', 'members', 'message_icons',
52
		'messages', 'moderators', 'package_servers', 'permission_profiles', 'permissions', 'personal_messages',
53
		'pm_recipients', 'poll_choices', 'polls', 'scheduled_tasks', 'sessions', 'settings', 'smileys',
54
		'themes', 'topics');
55
	foreach ($reservedTables as $k => $table_name)
56
		$reservedTables[$k] = strtolower($db_prefix . $table_name);
57
58
	// We in turn may need the extra stuff.
59
	db_extend('extra');
60
}
61
62
/**
63
 * This function can be used to create a table without worrying about schema