source: forum/install - neaktivni/convertors/convert_phpbb20.php@ 400

Last change on this file since 400 was 400, checked in by george, 16 years ago
  • Přidáno: Nové forum phpBB 3.
File size: 39.1 KB
Line 
1<?php
2/**
3*
4* @package install
5* @version $Id: convert_phpbb20.php 9155 2008-12-02 17:13:34Z acydburn $
6* @copyright (c) 2006 phpBB Group
7* @license http://opensource.org/licenses/gpl-license.php GNU Public License
8*
9*/
10
11/**
12* NOTE to potential convertor authors. Please use this file to get
13* familiar with the structure since we added some bare explanations here.
14*
15* Since this file gets included more than once on one page you are not able to add functions to it.
16* Instead use a functions_ file.
17*
18* @ignore
19*/
20if (!defined('IN_PHPBB'))
21{
22 exit;
23}
24
25include($phpbb_root_path . 'config.' . $phpEx);
26unset($dbpasswd);
27
28/**
29* $convertor_data provides some basic information about this convertor which is
30* used on the initial list of convertors and to populate the default settings
31*/
32$convertor_data = array(
33 'forum_name' => 'phpBB 2.0.x',
34 'version' => '1.0.2',
35 'phpbb_version' => '3.0.4',
36 'author' => '<a href="http://www.phpbb.com/">phpBB Group</a>',
37 'dbms' => $dbms,
38 'dbhost' => $dbhost,
39 'dbport' => $dbport,
40 'dbuser' => $dbuser,
41 'dbpasswd' => '',
42 'dbname' => $dbname,
43 'table_prefix' => 'phpbb_',
44 'forum_path' => '../forums',
45 'author_notes' => '',
46);
47
48/**
49* $tables is a list of the tables (minus prefix) which we expect to find in the
50* source forum. It is used to guess the prefix if the specified prefix is incorrect
51*/
52$tables = array(
53 'auth_access',
54 'banlist',
55 'categories',
56 'disallow',
57 'forum_prune',
58 'forums',
59 'groups',
60 'posts',
61 'posts_text',
62 'privmsgs',
63 'privmsgs_text',
64 'ranks',
65 'smilies',
66 'topics',
67 'topics_watch',
68 'user_group',
69 'users',
70 'vote_desc',
71 'vote_results',
72 'vote_voters',
73 'words'
74);
75
76/**
77* $config_schema details how the board configuration information is stored in the source forum.
78*
79* 'table_format' can take the value 'file' to indicate a config file. In this case array_name
80* is set to indicate the name of the array the config values are stored in
81* 'table_format' can be an array if the values are stored in a table which is an assosciative array
82* (as per phpBB 2.0.x)
83* If left empty, values are assumed to be stored in a table where each config setting is
84* a column (as per phpBB 1.x)
85*
86* In either of the latter cases 'table_name' indicates the name of the table in the database
87*
88* 'settings' is an array which maps the name of the config directive in the source forum
89* to the config directive in phpBB3. It can either be a direct mapping or use a function.
90* Please note that the contents of the old config value are passed to the function, therefore
91* an in-built function requiring the variable passed by reference is not able to be used. Since
92* empty() is such a function we created the function is_empty() to be used instead.
93*/
94$config_schema = array(
95 'table_name' => 'config',
96 'table_format' => array('config_name' => 'config_value'),
97 'settings' => array(
98 'allow_bbcode' => 'allow_bbcode',
99 'allow_smilies' => 'allow_smilies',
100 'allow_sig' => 'allow_sig',
101 'allow_namechange' => 'allow_namechange',
102 'allow_avatar_local' => 'allow_avatar_local',
103 'allow_avatar_remote' => 'allow_avatar_remote',
104 'allow_avatar_upload' => 'allow_avatar_upload',
105 'board_disable' => 'board_disable',
106 'sitename' => 'phpbb_set_encoding(sitename)',
107 'site_desc' => 'phpbb_set_encoding(site_desc)',
108 'session_length' => 'session_length',
109 'board_email_sig' => 'phpbb_set_encoding(board_email_sig)',
110 'posts_per_page' => 'posts_per_page',
111 'topics_per_page' => 'topics_per_page',
112 'enable_confirm' => 'enable_confirm',
113 'board_email_form' => 'board_email_form',
114 'override_user_style' => 'override_user_style',
115 'hot_threshold' => 'hot_threshold',
116 'max_poll_options' => 'max_poll_options',
117 'max_sig_chars' => 'max_sig_chars',
118 'pm_max_msgs' => 'max_inbox_privmsgs',
119 'smtp_delivery' => 'smtp_delivery',
120 'smtp_host' => 'smtp_host',
121 'smtp_username' => 'smtp_username',
122 'smtp_password' => 'smtp_password',
123 'require_activation' => 'require_activation',
124 'flood_interval' => 'flood_interval',
125 'avatar_filesize' => 'avatar_filesize',
126 'avatar_max_width' => 'avatar_max_width',
127 'avatar_max_height' => 'avatar_max_height',
128 'default_dateformat' => 'default_dateformat',
129 'board_timezone' => 'board_timezone',
130 'allow_privmsg' => 'not(privmsg_disable)',
131 'gzip_compress' => 'gzip_compress',
132 'coppa_enable' => 'is_empty(coppa_mail)',
133 'coppa_fax' => 'coppa_fax',
134 'coppa_mail' => 'coppa_mail',
135 'record_online_users' => 'record_online_users',
136 'record_online_date' => 'record_online_date',
137 'board_startdate' => 'board_startdate',
138 )
139);
140
141/**
142* $test_file is the name of a file which is present on the source
143* forum which can be used to check that the path specified by the
144* user was correct
145*/
146$test_file = 'modcp.php';
147
148/**
149* If this is set then we are not generating the first page of information but getting the conversion information.
150*/
151if (!$get_info)
152{
153 // Test to see if the birthday MOD is installed on the source forum
154 // Niels' birthday mod
155 if (get_config_value('birthday_required') !== false || get_config_value('bday_require') !== false)
156 {
157 define('MOD_BIRTHDAY', true);
158 }
159
160 // TerraFrost's validated birthday mod
161 if (get_config_value('bday_require') !== false)
162 {
163 define('MOD_BIRTHDAY_TERRA', true);
164 }
165
166 // Test to see if the attachment MOD is installed on the source forum
167 // If it is, we will convert this data as well
168 $src_db->sql_return_on_error(true);
169
170 $sql = "SELECT config_value
171 FROM {$convert->src_table_prefix}attachments_config
172 WHERE config_name = 'upload_dir'";
173 $result = $src_db->sql_query($sql);
174
175 if ($result && $row = $src_db->sql_fetchrow($result))
176 {
177 // Here the constant is defined
178 define('MOD_ATTACHMENT', true);
179
180 // Here i add more tables to be checked in the old forum
181 $tables += array(
182 'attachments',
183 'attachments_desc',
184 'extensions',
185 'extension_groups'
186 );
187
188 $src_db->sql_freeresult($result);
189 }
190 else if ($result)
191 {
192 $src_db->sql_freeresult($result);
193 }
194
195
196 /**
197 * Tests for further MODs can be included here.
198 * Please use constants for this, prefixing them with MOD_
199 */
200
201 $src_db->sql_return_on_error(false);
202
203 // Now let us set a temporary config variable for user id incrementing
204 $sql = "SELECT user_id
205 FROM {$convert->src_table_prefix}users
206 WHERE user_id = 1";
207 $result = $src_db->sql_query($sql);
208 $user_id = (int) $src_db->sql_fetchfield('user_id');
209 $src_db->sql_freeresult($result);
210
211 // If there is a user id 1, we need to increment user ids. :/
212 if ($user_id === 1)
213 {
214 // Try to get the maximum user id possible...
215 $sql = "SELECT MAX(user_id) AS max_user_id
216 FROM {$convert->src_table_prefix}users";
217 $result = $src_db->sql_query($sql);
218 $user_id = (int) $src_db->sql_fetchfield('max_user_id');
219 $src_db->sql_freeresult($result);
220
221 set_config('increment_user_id', ($user_id + 1), true);
222 }
223 else
224 {
225 set_config('increment_user_id', 0, true);
226 }
227
228 // Overwrite maximum avatar width/height
229 @define('DEFAULT_AVATAR_X_CUSTOM', get_config_value('avatar_max_width'));
230 @define('DEFAULT_AVATAR_Y_CUSTOM', get_config_value('avatar_max_height'));
231
232 // additional table used only during conversion
233 @define('USERCONV_TABLE', $table_prefix . 'userconv');
234
235/**
236* Description on how to use the convertor framework.
237*
238* 'schema' Syntax Description
239* -> 'target' => Target Table. If not specified the next table will be handled
240* -> 'primary' => Primary Key. If this is specified then this table is processed in batches
241* -> 'query_first' => array('target' or 'src', Query to execute before beginning the process
242* (if more than one then specified as array))
243* -> 'function_first' => Function to execute before beginning the process (if more than one then specified as array)
244* (This is mostly useful if variables need to be given to the converting process)
245* -> 'test_file' => This is not used at the moment but should be filled with a file from the old installation
246*
247* // DB Functions
248* 'distinct' => Add DISTINCT to the select query
249* 'where' => Add WHERE to the select query
250* 'group_by' => Add GROUP BY to the select query
251* 'left_join' => Add LEFT JOIN to the select query (if more than one joins specified as array)
252* 'having' => Add HAVING to the select query
253*
254* // DB INSERT array
255* This one consist of three parameters
256* First Parameter:
257* The key need to be filled within the target table
258* If this is empty, the target table gets not assigned the source value
259* Second Parameter:
260* Source value. If the first parameter is specified, it will be assigned this value.
261* If the first parameter is empty, this only gets added to the select query
262* Third Parameter:
263* Custom Function. Function to execute while storing source value into target table.
264* The functions return value get stored.
265* The function parameter consist of the value of the second parameter.
266*
267* types:
268* - empty string == execute nothing
269* - string == function to execute
270* - array == complex execution instructions
271*
272* Complex execution instructions:
273* @todo test complex execution instructions - in theory they will work fine
274*
275* By defining an array as the third parameter you are able to define some statements to be executed. The key
276* is defining what to execute, numbers can be appended...
277*
278* 'function' => execute function
279* 'execute' => run code, whereby all occurrences of {VALUE} get replaced by the last returned value.
280* The result *must* be assigned/stored to {RESULT}.
281* 'typecast' => typecast value
282*
283* The returned variables will be made always available to the next function to continue to work with.
284*
285* example (variable inputted is an integer of 1):
286*
287* array(
288* 'function1' => 'increment_by_one', // returned variable is 2
289* 'typecast' => 'string', // typecast variable to be a string
290* 'execute' => '{RESULT} = {VALUE} . ' is good';', // returned variable is '2 is good'
291* 'function2' => 'replace_good_with_bad', // returned variable is '2 is bad'
292* ),
293*
294*/
295
296 $convertor = array(
297 'test_file' => 'viewtopic.php',
298
299 'avatar_path' => get_config_value('avatar_path') . '/',
300 'avatar_gallery_path' => get_config_value('avatar_gallery_path') . '/',
301 'smilies_path' => get_config_value('smilies_path') . '/',
302 'upload_path' => (defined('MOD_ATTACHMENT')) ? phpbb_get_files_dir() . '/' : '',
303 'thumbnails' => (defined('MOD_ATTACHMENT')) ? array('thumbs/', 't_') : '',
304 'ranks_path' => false, // phpBB 2.0.x had no config value for a ranks path
305
306 // We empty some tables to have clean data available
307 'query_first' => array(
308 array('target', $convert->truncate_statement . SEARCH_RESULTS_TABLE),
309 array('target', $convert->truncate_statement . SEARCH_WORDLIST_TABLE),
310 array('target', $convert->truncate_statement . SEARCH_WORDMATCH_TABLE),
311 array('target', $convert->truncate_statement . LOG_TABLE),
312 ),
313
314// with this you are able to import all attachment files on the fly. For large boards this is not an option, therefore commented out by default.
315// Instead every file gets copied while processing the corresponding attachment entry.
316// if (defined("MOD_ATTACHMENT")) { import_attachment_files(); phpbb_copy_thumbnails(); }
317
318 // phpBB2 allowed some similar usernames to coexist which would have the same
319 // username_clean in phpBB3 which is not possible, so we'll give the admin a list
320 // of user ids and usernames and let him deicde what he wants to do with them
321 'execute_first' => '
322 phpbb_create_userconv_table();
323 import_avatar_gallery();
324 if (defined("MOD_ATTACHMENT")) phpbb_import_attach_config();
325 phpbb_insert_forums();
326 ',
327
328 'execute_last' => array('
329 add_bots();
330 ', '
331 update_folder_pm_count();
332 ', '
333 update_unread_count();
334 ', '
335 phpbb_convert_authentication(\'start\');
336 ', '
337 phpbb_convert_authentication(\'first\');
338 ', '
339 phpbb_convert_authentication(\'second\');
340 ', '
341 phpbb_convert_authentication(\'third\');
342 '),
343
344 'schema' => array(
345 array(
346 'target' => USERCONV_TABLE,
347 'query_first' => array('target', $convert->truncate_statement . USERCONV_TABLE),
348
349
350 array('user_id', 'users.user_id', ''),
351 array('username_clean', 'users.username', array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_clean_string')),
352 ),
353
354 array(
355 'target' => (defined('MOD_ATTACHMENT')) ? ATTACHMENTS_TABLE : '',
356 'primary' => 'attachments.attach_id',
357 'query_first' => (defined('MOD_ATTACHMENT')) ? array('target', $convert->truncate_statement . ATTACHMENTS_TABLE) : '',
358 'autoincrement' => 'attach_id',
359
360 array('attach_id', 'attachments.attach_id', ''),
361 array('post_msg_id', 'attachments.post_id', ''),
362 array('topic_id', 'posts.topic_id', ''),
363 array('in_message', 0, ''),
364 array('is_orphan', 0, ''),
365 array('poster_id', 'attachments.user_id_1 AS poster_id', 'phpbb_user_id'),
366 array('physical_filename', 'attachments_desc.physical_filename', 'import_attachment'),
367 array('real_filename', 'attachments_desc.real_filename', 'phpbb_set_encoding'),
368 array('download_count', 'attachments_desc.download_count', ''),
369 array('attach_comment', 'attachments_desc.comment', array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_htmlspecialchars')),
370 array('extension', 'attachments_desc.extension', ''),
371 array('mimetype', 'attachments_desc.mimetype', ''),
372 array('filesize', 'attachments_desc.filesize', ''),
373 array('filetime', 'attachments_desc.filetime', ''),
374 array('thumbnail', 'attachments_desc.thumbnail', ''),
375
376 'where' => 'attachments_desc.attach_id = attachments.attach_id AND attachments.privmsgs_id = 0 AND posts.post_id = attachments.post_id',
377 'group_by' => 'attachments.attach_id'
378 ),
379
380 array(
381 'target' => (defined('MOD_ATTACHMENT')) ? ATTACHMENTS_TABLE : '',
382 'primary' => 'attachments.attach_id',
383 'autoincrement' => 'attach_id',
384
385 array('attach_id', 'attachments.attach_id', ''),
386 array('post_msg_id', 'attachments.privmsgs_id', ''),
387 array('topic_id', 0, ''),
388 array('in_message', 1, ''),
389 array('is_orphan', 0, ''),
390 array('poster_id', 'attachments.user_id_1 AS poster_id', 'phpbb_user_id'),
391 array('physical_filename', 'attachments_desc.physical_filename', 'import_attachment'),
392 array('real_filename', 'attachments_desc.real_filename', ''),
393 array('download_count', 'attachments_desc.download_count', ''),
394 array('attach_comment', 'attachments_desc.comment', array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_htmlspecialchars')),
395 array('extension', 'attachments_desc.extension', ''),
396 array('mimetype', 'attachments_desc.mimetype', ''),
397 array('filesize', 'attachments_desc.filesize', ''),
398 array('filetime', 'attachments_desc.filetime', ''),
399 array('thumbnail', 'attachments_desc.thumbnail', ''),
400
401 'where' => 'attachments_desc.attach_id = attachments.attach_id AND attachments.post_id = 0',
402 'group_by' => 'attachments.attach_id'
403 ),
404
405 array(
406 'target' => (defined('MOD_ATTACHMENT')) ? EXTENSIONS_TABLE : '',
407 'query_first' => (defined('MOD_ATTACHMENT')) ? array('target', $convert->truncate_statement . EXTENSIONS_TABLE) : '',
408 'autoincrement' => 'extension_id',
409
410 array('extension_id', 'extensions.ext_id', ''),
411 array('group_id', 'extensions.group_id', ''),
412 array('extension', 'extensions.extension', ''),
413 ),
414
415 array(
416 'target' => (defined('MOD_ATTACHMENT')) ? EXTENSION_GROUPS_TABLE : '',
417 'query_first' => (defined('MOD_ATTACHMENT')) ? array('target', $convert->truncate_statement . EXTENSION_GROUPS_TABLE) : '',
418 'autoincrement' => 'group_id',
419
420 array('group_id', 'extension_groups.group_id', ''),
421 array('group_name', 'extension_groups.group_name', array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_htmlspecialchars')),
422 array('cat_id', 'extension_groups.cat_id', 'phpbb_attachment_category'),
423 array('allow_group', 'extension_groups.allow_group', ''),
424 array('download_mode', 1, ''),
425 array('upload_icon', '', ''),
426 array('max_filesize', 'extension_groups.max_filesize', ''),
427 array('allowed_forums', 'extension_groups.forum_permissions', 'phpbb_attachment_forum_perms'),
428 array('allow_in_pm', 1, ''),
429 ),
430
431 array(
432 'target' => BANLIST_TABLE,
433 'execute_first' => 'phpbb_check_username_collisions();',
434 'query_first' => array('target', $convert->truncate_statement . BANLIST_TABLE),
435
436 array('ban_ip', 'banlist.ban_ip', 'decode_ban_ip'),
437 array('ban_userid', 'banlist.ban_userid', 'phpbb_user_id'),
438 array('ban_email', 'banlist.ban_email', ''),
439 array('ban_reason', '', ''),
440 array('ban_give_reason', '', ''),
441
442 'where' => "banlist.ban_ip NOT LIKE '%.%'",
443 ),
444
445 array(
446 'target' => BANLIST_TABLE,
447
448 array('ban_ip', 'banlist.ban_ip', ''),
449 array('ban_userid', 0, ''),
450 array('ban_email', '', ''),
451 array('ban_reason', '', ''),
452 array('ban_give_reason', '', ''),
453
454 'where' => "banlist.ban_ip LIKE '%.%'",
455 ),
456
457 array(
458 'target' => DISALLOW_TABLE,
459 'query_first' => array('target', $convert->truncate_statement . DISALLOW_TABLE),
460
461 array('disallow_username', 'disallow.disallow_username', 'phpbb_disallowed_username'),
462 ),
463
464 array(
465 'target' => RANKS_TABLE,
466 'query_first' => array('target', $convert->truncate_statement . RANKS_TABLE),
467 'autoincrement' => 'rank_id',
468
469 array('rank_id', 'ranks.rank_id', ''),
470 array('rank_title', 'ranks.rank_title', array('function1' => 'phpbb_set_default_encoding', 'function2' => 'utf8_htmlspecialchars')),
471 array('rank_min', 'ranks.rank_min', array('typecast' => 'int', 'execute' => '{RESULT} = ({VALUE}[0] < 0) ? 0 : {VALUE}[0];')),
472 array('rank_special', 'ranks.rank_special', ''),
473 array('rank_image', 'ranks.rank_image', 'import_rank'),
474 ),
475
476 array(
477 'target' => TOPICS_TABLE,
478 'query_first' => array('target', $convert->truncate_statement . TOPICS_TABLE),
479 'primary' => 'topics.topic_id',
480 'autoincrement' => 'topic_id',
481
482 array('topic_id', 'topics.topic_id', ''),
483 array('forum_id', 'topics.forum_id', ''),
484 array('icon_id', 0, ''),
485 array('topic_poster', 'topics.topic_poster AS poster_id', 'phpbb_user_id'),
486 array('topic_attachment', ((defined('MOD_ATTACHMENT')) ? 'topics.topic_attachment' : 0), ''),
487 array('topic_title', 'topics.topic_title', 'phpbb_set_encoding'),
488 array('topic_time', 'topics.topic_time', ''),
489 array('topic_views', 'topics.topic_views', ''),
490 array('topic_replies', 'topics.topic_replies', ''),
491 array('topic_replies_real', 'topics.topic_replies', ''),
492 array('topic_last_post_id', 'topics.topic_last_post_id', ''),
493 array('topic_status', 'topics.topic_status', 'is_topic_locked'),
494 array('topic_moved_id', 0, ''),
495 array('topic_type', 'topics.topic_type', 'phpbb_convert_topic_type'),
496 array('topic_first_post_id', 'topics.topic_first_post_id', ''),
497 array('topic_last_view_time', 'posts.post_time', ''),
498 array('poll_title', 'vote_desc.vote_text', array('function1' => 'null_to_str', 'function2' => 'phpbb_set_encoding', 'function3' => 'utf8_htmlspecialchars')),
499 array('poll_start', 'vote_desc.vote_start', 'null_to_zero'),
500 array('poll_length', 'vote_desc.vote_length', 'null_to_zero'),
501 array('poll_max_options', 1, ''),
502 array('poll_vote_change', 0, ''),
503
504 'left_join' => array ( 'topics LEFT JOIN vote_desc ON topics.topic_id = vote_desc.topic_id AND topics.topic_vote = 1',
505 'topics LEFT JOIN posts ON topics.topic_last_post_id = posts.post_id',
506 ),
507 'where' => 'topics.topic_moved_id = 0',
508 ),
509
510 array(
511 'target' => TOPICS_TABLE,
512 'primary' => 'topics.topic_id',
513 'autoincrement' => 'topic_id',
514
515 array('topic_id', 'topics.topic_id', ''),
516 array('forum_id', 'topics.forum_id', ''),
517 array('icon_id', 0, ''),
518 array('topic_poster', 'topics.topic_poster AS poster_id', 'phpbb_user_id'),
519 array('topic_attachment', ((defined('MOD_ATTACHMENT')) ? 'topics.topic_attachment' : 0), ''),
520 array('topic_title', 'topics.topic_title', 'phpbb_set_encoding'),
521 array('topic_time', 'topics.topic_time', ''),
522 array('topic_views', 'topics.topic_views', ''),
523 array('topic_replies', 'topics.topic_replies', ''),
524 array('topic_replies_real', 'topics.topic_replies', ''),
525 array('topic_last_post_id', 'topics.topic_last_post_id', ''),
526 array('topic_status', ITEM_MOVED, ''),
527 array('topic_moved_id', 'topics.topic_moved_id', ''),
528 array('topic_type', 'topics.topic_type', 'phpbb_convert_topic_type'),
529 array('topic_first_post_id', 'topics.topic_first_post_id', ''),
530
531 array('poll_title', 'vote_desc.vote_text', array('function1' => 'null_to_str', 'function2' => 'phpbb_set_encoding', 'function3' => 'utf8_htmlspecialchars')),
532 array('poll_start', 'vote_desc.vote_start', 'null_to_zero'),
533 array('poll_length', 'vote_desc.vote_length', 'null_to_zero'),
534 array('poll_max_options', 1, ''),
535 array('poll_vote_change', 0, ''),
536
537 'left_join' => 'topics LEFT JOIN vote_desc ON topics.topic_id = vote_desc.topic_id AND topics.topic_vote = 1',
538 'where' => 'topics.topic_moved_id <> 0',
539 ),
540
541 array(
542 'target' => TOPICS_WATCH_TABLE,
543 'primary' => 'topics_watch.topic_id',
544 'query_first' => array('target', $convert->truncate_statement . TOPICS_WATCH_TABLE),
545
546 array('topic_id', 'topics_watch.topic_id', ''),
547 array('user_id', 'topics_watch.user_id', 'phpbb_user_id'),
548 array('notify_status', 'topics_watch.notify_status', ''),
549 ),
550
551 array(
552 'target' => SMILIES_TABLE,
553 'query_first' => array('target', $convert->truncate_statement . SMILIES_TABLE),
554 'autoincrement' => 'smiley_id',
555
556 array('smiley_id', 'smilies.smilies_id', ''),
557 array('code', 'smilies.code', array('function1' => 'phpbb_smilie_html_decode', 'function2' => 'phpbb_set_encoding', 'function3' => 'utf8_htmlspecialchars')),
558 array('emotion', 'smilies.emoticon', 'phpbb_set_encoding'),
559 array('smiley_url', 'smilies.smile_url', 'import_smiley'),
560 array('smiley_width', 'smilies.smile_url', 'get_smiley_width'),
561 array('smiley_height', 'smilies.smile_url', 'get_smiley_height'),
562 array('smiley_order', 'smilies.smilies_id', ''),
563 array('display_on_posting', 'smilies.smilies_id', 'get_smiley_display'),
564
565 'order_by' => 'smilies.smilies_id ASC',
566 ),
567
568 array(
569 'target' => POLL_OPTIONS_TABLE,
570 'primary' => 'vote_results.vote_option_id',
571 'query_first' => array('target', $convert->truncate_statement . POLL_OPTIONS_TABLE),
572
573 array('poll_option_id', 'vote_results.vote_option_id', ''),
574 array('topic_id', 'vote_desc.topic_id', ''),
575 array('', 'topics.topic_poster AS poster_id', 'phpbb_user_id'),
576 array('poll_option_text', 'vote_results.vote_option_text', array('function1' => 'phpbb_set_encoding', 'function2' => 'utf8_htmlspecialchars')),
577 array('poll_option_total', 'vote_results.vote_result', ''),
578
579 'where' => 'vote_results.vote_id = vote_desc.vote_id',
580 'left_join' => 'vote_desc LEFT JOIN topics ON topics.topic_id = vote_desc.topic_id',
581 ),
582
583 array(
584 'target' => POLL_VOTES_TABLE,
585 'primary' => 'vote_desc.topic_id',
586 'query_first' => array('target', $convert->truncate_statement . POLL_VOTES_TABLE),
587
588 array('poll_option_id', VOTE_CONVERTED, ''),
589 array('topic_id', 'vote_desc.topic_id', ''),
590 array('vote_user_id', 'vote_voters.vote_user_id', 'phpbb_user_id'),
591 array('vote_user_ip', 'vote_voters.vote_user_ip', 'decode_ip'),
592
593 'where' => 'vote_voters.vote_id = vote_desc.vote_id',
594 ),
595
596 array(
597 'target' => WORDS_TABLE,
598 'primary' => 'words.word_id',
599 'query_first' => array('target', $convert->truncate_statement . WORDS_TABLE),
600 'autoincrement' => 'word_id',
601
602 array('word_id', 'words.word_id', ''),
603 array('word', 'words.word', 'phpbb_set_encoding'),
604 array('replacement', 'words.replacement', 'phpbb_set_encoding'),
605 ),
606
607 array(
608 'target' => POSTS_TABLE,
609 'primary' => 'posts.post_id',
610 'autoincrement' => 'post_id',
611 'query_first' => array('target', $convert->truncate_statement . POSTS_TABLE),
612 'execute_first' => '
613 $config["max_post_chars"] = 0;
614 $config["max_quote_depth"] = 0;
615 ',
616
617 array('post_id', 'posts.post_id', ''),
618 array('topic_id', 'posts.topic_id', ''),
619 array('forum_id', 'posts.forum_id', ''),
620 array('poster_id', 'posts.poster_id', 'phpbb_user_id'),
621 array('icon_id', 0, ''),
622 array('poster_ip', 'posts.poster_ip', 'decode_ip'),
623 array('post_time', 'posts.post_time', ''),
624 array('enable_bbcode', 'posts.enable_bbcode', ''),
625 array('', 'posts.enable_html', ''),
626 array('enable_smilies', 'posts.enable_smilies', ''),
627 array('enable_sig', 'posts.enable_sig', ''),
628 array('enable_magic_url', 1, ''),
629 array('post_username', 'posts.post_username', 'phpbb_set_encoding'),
630 array('post_subject', 'posts_text.post_subject', 'phpbb_set_encoding'),
631 array('post_attachment', ((defined('MOD_ATTACHMENT')) ? 'posts.post_attachment' : 0), ''),
632 array('post_edit_time', 'posts.post_edit_time', array('typecast' => 'int')),
633 array('post_edit_count', 'posts.post_edit_count', ''),
634 array('post_edit_reason', '', ''),
635 array('post_edit_user', '', 'phpbb_post_edit_user'),
636
637 array('bbcode_uid', 'posts.post_time', 'make_uid'),
638 array('post_text', 'posts_text.post_text', 'phpbb_prepare_message'),
639 array('', 'posts_text.bbcode_uid AS old_bbcode_uid', ''),
640 array('bbcode_bitfield', '', 'get_bbcode_bitfield'),
641 array('post_checksum', '', ''),
642
643 // Commented out inline search indexing, this takes up a LOT of time. :D
644 // @todo We either need to enable this or call the rebuild search functionality post convert
645/* array('', '', 'search_indexing'),
646 array('', 'posts_text.post_text AS message', ''),
647 array('', 'posts_text.post_subject AS title', ''),*/
648
649 'where' => 'posts.post_id = posts_text.post_id'
650 ),
651
652 array(
653 'target' => PRIVMSGS_TABLE,
654 'primary' => 'privmsgs.privmsgs_id',
655 'autoincrement' => 'msg_id',
656 'query_first' => array(
657 array('target', $convert->truncate_statement . PRIVMSGS_TABLE),
658 array('target', $convert->truncate_statement . PRIVMSGS_RULES_TABLE),
659 ),
660
661 'execute_first' => '
662 $config["max_post_chars"] = 0;
663 $config["max_quote_depth"] = 0;
664 ',
665
666 array('msg_id', 'privmsgs.privmsgs_id', ''),
667 array('root_level', 0, ''),
668 array('author_id', 'privmsgs.privmsgs_from_userid AS poster_id', 'phpbb_user_id'),
669 array('icon_id', 0, ''),
670 array('author_ip', 'privmsgs.privmsgs_ip', 'decode_ip'),
671 array('message_time', 'privmsgs.privmsgs_date', ''),
672 array('enable_bbcode', 'privmsgs.privmsgs_enable_bbcode AS enable_bbcode', ''),
673 array('', 'privmsgs.privmsgs_enable_html AS enable_html', ''),
674 array('enable_smilies', 'privmsgs.privmsgs_enable_smilies AS enable_smilies', ''),
675 array('enable_magic_url', 1, ''),
676 array('enable_sig', 'privmsgs.privmsgs_attach_sig', ''),
677 array('message_subject', 'privmsgs.privmsgs_subject', 'phpbb_set_encoding'), // Already specialchared in 2.0.x
678 array('message_attachment', ((defined('MOD_ATTACHMENT')) ? 'privmsgs.privmsgs_attachment' : 0), ''),
679 array('message_edit_reason', '', ''),
680 array('message_edit_user', 0, ''),
681 array('message_edit_time', 0, ''),
682 array('message_edit_count', 0, ''),
683
684 array('bbcode_uid', 'privmsgs.privmsgs_date AS post_time', 'make_uid'),
685 array('message_text', 'privmsgs_text.privmsgs_text', 'phpbb_prepare_message'),
686 array('', 'privmsgs_text.privmsgs_bbcode_uid AS old_bbcode_uid', ''),
687 array('bbcode_bitfield', '', 'get_bbcode_bitfield'),
688 array('to_address', 'privmsgs.privmsgs_to_userid', 'phpbb_privmsgs_to_userid'),
689 array('bcc_address', '', ''),
690
691 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id'
692 ),
693
694 array(
695 'target' => PRIVMSGS_FOLDER_TABLE,
696 'primary' => 'users.user_id',
697 'query_first' => array('target', $convert->truncate_statement . PRIVMSGS_FOLDER_TABLE),
698
699 array('user_id', 'users.user_id', 'phpbb_user_id'),
700 array('folder_name', $user->lang['CONV_SAVED_MESSAGES'], ''),
701 array('pm_count', 0, ''),
702
703 'where' => 'users.user_id <> -1',
704 ),
705
706 // Inbox
707 array(
708 'target' => PRIVMSGS_TO_TABLE,
709 'primary' => 'privmsgs.privmsgs_id',
710 'query_first' => array('target', $convert->truncate_statement . PRIVMSGS_TO_TABLE),
711
712 array('msg_id', 'privmsgs.privmsgs_id', ''),
713 array('user_id', 'privmsgs.privmsgs_to_userid', 'phpbb_user_id'),
714 array('author_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
715 array('pm_deleted', 0, ''),
716 array('pm_new', 'privmsgs.privmsgs_type', 'phpbb_new_pm'),
717 array('pm_unread', 'privmsgs.privmsgs_type', 'phpbb_unread_pm'),
718 array('pm_replied', 0, ''),
719 array('pm_marked', 0, ''),
720 array('pm_forwarded', 0, ''),
721 array('folder_id', PRIVMSGS_INBOX, ''),
722
723 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
724 AND (privmsgs.privmsgs_type = 0 OR privmsgs.privmsgs_type = 1 OR privmsgs.privmsgs_type = 5)',
725 ),
726
727 // Outbox
728 array(
729 'target' => PRIVMSGS_TO_TABLE,
730 'primary' => 'privmsgs.privmsgs_id',
731
732 array('msg_id', 'privmsgs.privmsgs_id', ''),
733 array('user_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
734 array('author_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
735 array('pm_deleted', 0, ''),
736 array('pm_new', 0, ''),
737 array('pm_unread', 0, ''),
738 array('pm_replied', 0, ''),
739 array('pm_marked', 0, ''),
740 array('pm_forwarded', 0, ''),
741 array('folder_id', PRIVMSGS_OUTBOX, ''),
742
743 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
744 AND (privmsgs.privmsgs_type = 1 OR privmsgs.privmsgs_type = 5)',
745 ),
746
747 // Sentbox
748 array(
749 'target' => PRIVMSGS_TO_TABLE,
750 'primary' => 'privmsgs.privmsgs_id',
751
752 array('msg_id', 'privmsgs.privmsgs_id', ''),
753 array('user_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
754 array('author_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
755 array('pm_deleted', 0, ''),
756 array('pm_new', 'privmsgs.privmsgs_type', 'phpbb_new_pm'),
757 array('pm_unread', 'privmsgs.privmsgs_type', 'phpbb_unread_pm'),
758 array('pm_replied', 0, ''),
759 array('pm_marked', 0, ''),
760 array('pm_forwarded', 0, ''),
761 array('folder_id', PRIVMSGS_SENTBOX, ''),
762
763 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
764 AND privmsgs.privmsgs_type = 2',
765 ),
766
767 // Savebox (SAVED IN)
768 array(
769 'target' => PRIVMSGS_TO_TABLE,
770 'primary' => 'privmsgs.privmsgs_id',
771
772 array('msg_id', 'privmsgs.privmsgs_id', ''),
773 array('user_id', 'privmsgs.privmsgs_to_userid', 'phpbb_user_id'),
774 array('author_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
775 array('pm_deleted', 0, ''),
776 array('pm_new', 'privmsgs.privmsgs_type', 'phpbb_new_pm'),
777 array('pm_unread', 'privmsgs.privmsgs_type', 'phpbb_unread_pm'),
778 array('pm_replied', 0, ''),
779 array('pm_marked', 0, ''),
780 array('pm_forwarded', 0, ''),
781 array('folder_id', 'privmsgs.privmsgs_to_userid', 'phpbb_get_savebox_id'),
782
783 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
784 AND privmsgs.privmsgs_type = 3',
785 ),
786
787 // Savebox (SAVED OUT)
788 array(
789 'target' => PRIVMSGS_TO_TABLE,
790 'primary' => 'privmsgs.privmsgs_id',
791
792 array('msg_id', 'privmsgs.privmsgs_id', ''),
793 array('user_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
794 array('author_id', 'privmsgs.privmsgs_from_userid', 'phpbb_user_id'),
795 array('pm_deleted', 0, ''),
796 array('pm_new', 'privmsgs.privmsgs_type', 'phpbb_new_pm'),
797 array('pm_unread', 'privmsgs.privmsgs_type', 'phpbb_unread_pm'),
798 array('pm_replied', 0, ''),
799 array('pm_marked', 0, ''),
800 array('pm_forwarded', 0, ''),
801 array('folder_id', 'privmsgs.privmsgs_from_userid', 'phpbb_get_savebox_id'),
802
803 'where' => 'privmsgs.privmsgs_id = privmsgs_text.privmsgs_text_id
804 AND privmsgs.privmsgs_type = 4',
805 ),
806
807 array(
808 'target' => GROUPS_TABLE,
809 'autoincrement' => 'group_id',
810 'query_first' => array('target', $convert->truncate_statement . GROUPS_TABLE),
811
812 array('group_id', 'groups.group_id', ''),
813 array('group_type', 'groups.group_type', 'phpbb_convert_group_type'),
814 array('group_display', 0, ''),
815 array('group_legend', 0, ''),
816 array('group_name', 'groups.group_name', 'phpbb_convert_group_name'), // phpbb_set_encoding called in phpbb_convert_group_name
817 array('group_desc', 'groups.group_description', 'phpbb_set_encoding'),
818
819 'where' => 'groups.group_single_user = 0',
820 ),
821
822 array(
823 'target' => USER_GROUP_TABLE,
824 'query_first' => array('target', $convert->truncate_statement . USER_GROUP_TABLE),
825 'execute_first' => '
826 add_default_groups();
827 ',
828
829 array('group_id', 'groups.group_id', ''),
830 array('user_id', 'groups.group_moderator', 'phpbb_user_id'),
831 array('group_leader', 1, ''),
832 array('user_pending', 0, ''),
833
834 'where' => 'groups.group_single_user = 0 AND groups.group_moderator <> 0',
835 ),
836
837 array(
838 'target' => USER_GROUP_TABLE,
839
840 array('group_id', 'user_group.group_id', ''),
841 array('user_id', 'user_group.user_id', 'phpbb_user_id'),
842 array('group_leader', 0, ''),
843 array('user_pending', 'user_group.user_pending', ''),
844
845 'where' => 'user_group.group_id = groups.group_id AND groups.group_single_user = 0 AND groups.group_moderator <> user_group.user_id',
846 ),
847
848 array(
849 'target' => USERS_TABLE,
850 'primary' => 'users.user_id',
851 'autoincrement' => 'user_id',
852 'query_first' => array(
853 array('target', 'DELETE FROM ' . USERS_TABLE . ' WHERE user_id <> ' . ANONYMOUS),
854 array('target', $convert->truncate_statement . BOTS_TABLE)
855 ),
856
857 'execute_last' => '
858 remove_invalid_users();
859 ',
860
861 array('user_id', 'users.user_id', 'phpbb_user_id'),
862 array('', 'users.user_id AS poster_id', 'phpbb_user_id'),
863 array('user_type', 'users.user_active', 'set_user_type'),
864 array('group_id', 'users.user_level', 'phpbb_set_primary_group'),
865 array('user_regdate', 'users.user_regdate', ''),
866 array('username', 'users.username', 'phpbb_set_default_encoding'), // recode to utf8 with default lang
867 array('username_clean', 'users.username', array('function1' => 'phpbb_set_default_encoding', 'function2' => 'utf8_clean_string')),
868 array('user_password', 'users.user_password', ''),
869 array('user_pass_convert', 1, ''),
870 array('user_posts', 'users.user_posts', 'intval'),
871 array('user_email', 'users.user_email', 'strtolower'),
872 array('user_email_hash', 'users.user_email', 'gen_email_hash'),
873 array('user_birthday', ((defined('MOD_BIRTHDAY')) ? 'users.user_birthday' : ''), 'phpbb_get_birthday'),
874 array('user_lastvisit', 'users.user_lastvisit', 'intval'),
875 array('user_lastmark', 'users.user_lastvisit', 'intval'),
876 array('user_lang', $config['default_lang'], ''),
877 array('', 'users.user_lang', ''),
878 array('user_timezone', 'users.user_timezone', 'floatval'),
879 array('user_dateformat', 'users.user_dateformat', array('function1' => 'phpbb_set_encoding', 'function2' => 'fill_dateformat')),
880 array('user_inactive_reason', '', 'phpbb_inactive_reason'),
881 array('user_inactive_time', '', 'phpbb_inactive_time'),
882
883 array('user_interests', 'users.user_interests', array('function1' => 'phpbb_set_encoding')),
884 array('user_occ', 'users.user_occ', array('function1' => 'phpbb_set_encoding')),
885 array('user_website', 'users.user_website', 'validate_website'),
886 array('user_jabber', '', ''),
887 array('user_msnm', 'users.user_msnm', array('function1' => 'phpbb_set_encoding')),
888 array('user_yim', 'users.user_yim', array('function1' => 'phpbb_set_encoding')),
889 array('user_aim', 'users.user_aim', array('function1' => 'phpbb_set_encoding')),
890 array('user_icq', 'users.user_icq', array('function1' => 'phpbb_set_encoding')),
891 array('user_from', 'users.user_from', array('function1' => 'phpbb_set_encoding')),
892 array('user_rank', 'users.user_rank', 'intval'),
893 array('user_permissions', '', ''),
894
895 array('user_avatar', 'users.user_avatar', 'phpbb_import_avatar'),
896 array('user_avatar_type', 'users.user_avatar_type', 'phpbb_avatar_type'),
897 array('user_avatar_width', 'users.user_avatar', 'phpbb_get_avatar_width'),
898 array('user_avatar_height', 'users.user_avatar', 'phpbb_get_avatar_height'),
899
900 array('user_new_privmsg', 'users.user_new_privmsg', ''),
901 array('user_unread_privmsg', 0, ''), //'users.user_unread_privmsg'
902 array('user_last_privmsg', 'users.user_last_privmsg', 'intval'),
903 array('user_emailtime', 'users.user_emailtime', 'null_to_zero'),
904 array('user_notify', 'users.user_notify', 'intval'),
905 array('user_notify_pm', 'users.user_notify_pm', 'intval'),
906 array('user_notify_type', NOTIFY_EMAIL, ''),
907 array('user_allow_pm', 'users.user_allow_pm', 'intval'),
908 array('user_allow_viewonline', 'users.user_allow_viewonline', 'intval'),
909 array('user_allow_viewemail', 'users.user_viewemail', 'intval'),
910 array('user_actkey', 'users.user_actkey', ''),
911 array('user_newpasswd', '', ''), // Users need to re-request their password...
912 array('user_style', $config['default_style'], ''),
913
914 array('user_options', '', 'set_user_options'),
915 array('', 'users.user_popup_pm AS popuppm', ''),
916 array('', 'users.user_allowhtml AS html', ''),
917 array('', 'users.user_allowbbcode AS bbcode', ''),
918 array('', 'users.user_allowsmile AS smile', ''),
919 array('', 'users.user_attachsig AS attachsig',''),
920
921 array('user_sig_bbcode_uid', 'users.user_regdate', 'make_uid'),
922 array('user_sig', 'users.user_sig', 'phpbb_prepare_message'),
923 array('', 'users.user_sig_bbcode_uid AS old_bbcode_uid', ''),
924 array('user_sig_bbcode_bitfield', '', 'get_bbcode_bitfield'),
925 array('', 'users.user_regdate AS post_time', ''),
926
927 'where' => 'users.user_id <> -1',
928 ),
929 ),
930 );
931}
932
933?>
Note: See TracBrowser for help on using the repository browser.