upgrade_2-1_mysql.sql 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200
  1. /* ATTENTION: You don't need to run or use this file! The upgrade.php script does everything for you! */
  2. /******************************************************************************/
  3. --- Adding new settings...
  4. /******************************************************************************/
  5. ---# Adding login history...
  6. CREATE TABLE IF NOT EXISTS {$db_prefix}member_logins (
  7. id_login int(10) NOT NULL auto_increment,
  8. id_member mediumint(8) NOT NULL,
  9. time int(10) NOT NULL,
  10. ip varchar(255) NOT NULL default '',
  11. ip2 varchar(255) NOT NULL default '',
  12. PRIMARY KEY id_login(id_login),
  13. KEY id_member (id_member),
  14. KEY time (time)
  15. ) ENGINE=MyISAM{$db_collation};
  16. ---#
  17. ---# Copying the current package backup setting...
  18. ---{
  19. if (!isset($modSettings['package_make_full_backups']) && isset($modSettings['package_make_backups']))
  20. upgrade_query("
  21. INSERT INTO {$db_prefix}settings
  22. (variable, value)
  23. VALUES
  24. ('package_make_full_backups', '" . $modSettings['package_make_backups'] . "')");
  25. ---}
  26. ---#
  27. ---# Copying the current "allow users to disable word censor" setting...
  28. ---{
  29. if (!isset($modSettings['allow_no_censored']))
  30. {
  31. $request = upgrade_query("
  32. SELECT value
  33. FROM {$db_prefix}themes
  34. WHERE variable='allow_no_censored'
  35. AND id_theme = 1 OR id_theme = '$modSettings[theme_default]'
  36. ");
  37. // Is it set for either "default" or the one they've set as default?
  38. while ($row = $smcFunc['db_fetch_assoc']($request))
  39. {
  40. if ($row['value'] == 1)
  41. {
  42. upgrade_query("
  43. INSERT INTO {$db_prefix}settings
  44. VALUES ('allow_no_censored', 1)
  45. ");
  46. // Don't do this twice...
  47. break;
  48. }
  49. }
  50. }
  51. ---}
  52. ---#
  53. ---# Adding new "topic_move_any" setting
  54. INSERT INTO {$db_prefix}settings (variable, value) VALUES ('topic_move_any', '1');
  55. ---#
  56. ---# Adding new "browser_cache" setting
  57. INSERT INTO {$db_prefix}settings (variable, value) VALUES ('browser_cache', '?alph21');
  58. ---#
  59. /******************************************************************************/
  60. --- Updating legacy attachments...
  61. /******************************************************************************/
  62. ---# Converting legacy attachments.
  63. ---{
  64. // Need to know a few things first.
  65. $custom_av_dir = !empty($modSettings['custom_avatar_dir']) ? $modSettings['custom_avatar_dir'] : $GLOBALS['boarddir'] .'/custom_avatar';
  66. // This little fellow has to cooperate...
  67. if (!is_writable($custom_av_dir))
  68. @chmod($custom_av_dir, 0777);
  69. $request = upgrade_query("
  70. SELECT MAX(id_attach)
  71. FROM {$db_prefix}attachments");
  72. list ($step_progress['total']) = $smcFunc['db_fetch_row']($request);
  73. $smcFunc['db_free_result']($request);
  74. $_GET['a'] = isset($_GET['a']) ? (int) $_GET['a'] : 0;
  75. $step_progress['name'] = 'Converting legacy attachments';
  76. $step_progress['current'] = $_GET['a'];
  77. // We may be using multiple attachment directories.
  78. if (!empty($modSettings['currentAttachmentUploadDir']) && !is_array($modSettings['attachmentUploadDir']))
  79. $modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
  80. $is_done = false;
  81. while (!$is_done)
  82. {
  83. nextSubStep($substep);
  84. $fileHash = '';
  85. $request = upgrade_query("
  86. SELECT id_attach, id_folder, filename, file_hash, mime_type
  87. FROM {$db_prefix}attachments
  88. WHERE attachment_type != 1
  89. LIMIT $_GET[a], 100");
  90. // Finished?
  91. if ($smcFunc['db_num_rows']($request) == 0)
  92. $is_done = true;
  93. while ($row = $smcFunc['db_fetch_assoc']($request))
  94. {
  95. // The current folder.
  96. $currentFolder = !empty($modSettings['currentAttachmentUploadDir']) ? $modSettings['attachmentUploadDir'][$row['id_folder']] : $modSettings['attachmentUploadDir'];
  97. // Old School?
  98. if (empty($row['file_hash']))
  99. {
  100. // Remove international characters (windows-1252)
  101. // These lines should never be needed again. Still, behave.
  102. if (empty($db_character_set) || $db_character_set != 'utf8')
  103. {
  104. $row['filename'] = strtr($row['filename'],
  105. "\x8a\x8e\x9a\x9e\x9f\xc0\xc1\xc2\xc3\xc4\xc5\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd1\xd2\xd3\xd4\xd5\xd6\xd8\xd9\xda\xdb\xdc\xdd\xe0\xe1\xe2\xe3\xe4\xe5\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc\xfd\xff",
  106. 'SZszYAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy');
  107. $row['filename'] = strtr($row['filename'], array("\xde" => 'TH', "\xfe" =>
  108. 'th', "\xd0" => 'DH', "\xf0" => 'dh', "\xdf" => 'ss', "\x8c" => 'OE',
  109. "\x9c" => 'oe', "\xc6" => 'AE', "\xe6" => 'ae', "\xb5" => 'u'));
  110. }
  111. // Sorry, no spaces, dots, or anything else but letters allowed.
  112. $row['filename'] = preg_replace(array('/\s/', '/[^\w_\.\-]/'), array('_', ''), $row['filename']);
  113. // Create a nice hash.
  114. $fileHash = sha1(md5($row['filename'] . time()) . mt_rand());
  115. // The old file, we need to know if the filename was encrypted or not.
  116. if (file_exists($currentFolder . '/' . $row['id_attach']. '_' . strtr($row['filename'], '.', '_') . md5($row['filename'])))
  117. $oldFile = $currentFolder . '/' . $row['id_attach']. '_' . strtr($row['filename'], '.', '_') . md5($row['filename']);
  118. else if (file_exists($currentFolder . '/' . $row['filename']));
  119. $oldFile = $currentFolder . '/' . $row['filename'];
  120. // Build the new file.
  121. $newFile = $currentFolder . '/' . $row['id_attach'] . '_' . $fileHash .'.dat';
  122. }
  123. // Just rename the file.
  124. else
  125. {
  126. $oldFile = $currentFolder . '/' . $row['id_attach'] . '_' . $row['file_hash'];
  127. $newFile = $currentFolder . '/' . $row['id_attach'] . '_' . $row['file_hash'] .'.dat';
  128. }
  129. // Check if the av is an attachment
  130. if ($row['id_member'] != 0)
  131. if (rename($oldFile, $custom_av_dir . '/' . $row['filename']))
  132. upgrade_query("
  133. UPDATE {$db_prefix}attachments
  134. SET file_hash = '', attachment_type = 1
  135. WHERE id_attach = $row[id_attach]");
  136. // Just a regular attachment.
  137. else
  138. rename($oldFile, $newFile);
  139. // Only update this if it was successful and the file was using the old system.
  140. if (empty($row['file_hash']) && !empty($fileHash) && file_exists($newFile) && !file_exists($oldFile))
  141. upgrade_query("
  142. UPDATE {$db_prefix}attachments
  143. SET file_hash = '$fileHash'
  144. WHERE id_attach = $row[id_attach]");
  145. // While we're here, do we need to update the mime_type?
  146. if (empty($row['mime_type']) && file_exists($newFile))
  147. {
  148. $size = @getimagesize($newFile);
  149. if (!empty($size['mime']))
  150. $smcFunc['db_query']('', '
  151. UPDATE {db_prefix}attachments
  152. SET mime_type = {string:mime_type}
  153. WHERE id_attach = {int:id_attach}',
  154. array(
  155. 'id_attach' => $row['id_attach'],
  156. 'mime_type' => substr($size['mime'], 0, 20),
  157. )
  158. );
  159. }
  160. }
  161. $smcFunc['db_free_result']($request);
  162. $_GET['a'] += 100;
  163. $step_progress['current'] = $_GET['a'];
  164. }
  165. unset($_GET['a']);
  166. ---}
  167. ---#
  168. ---# Fixing invalid sizes on attachments
  169. ---{
  170. $attachs = array();
  171. // If id_member = 0, then it's not an avatar
  172. // If attachment_type = 0, then it's also not a thumbnail
  173. // Theory says there shouldn't be *that* many of these
  174. $request = $smcFunc['db_query']('', '
  175. SELECT id_attach, mime_type, width, height
  176. FROM {db_prefix}attachments
  177. WHERE id_member = 0
  178. AND attachment_type = 0');
  179. while ($row = $smcFunc['db_fetch_assoc']($request))
  180. {
  181. if (($row['width'] > 0 || $row['height'] > 0) && strpos($row['mime_type'], 'image') !== 0)
  182. $attachs[] = $row['id_attach'];
  183. }
  184. $smcFunc['db_free_result']($request);
  185. if (!empty($attachs))
  186. $smcFunc['db_query']('', '
  187. UPDATE {db_prefix}attachments
  188. SET width = 0,
  189. height = 0
  190. WHERE id_attach IN ({array_int:attachs})',
  191. array(
  192. 'attachs' => $attachs,
  193. )
  194. );
  195. ---}
  196. ---#
  197. /******************************************************************************/
  198. --- Adding support for IPv6...
  199. /******************************************************************************/
  200. ---# Adding new columns to ban items...
  201. ALTER TABLE {$db_prefix}ban_items
  202. ADD COLUMN ip_low5 smallint(255) unsigned NOT NULL DEFAULT '0',
  203. ADD COLUMN ip_high5 smallint(255) unsigned NOT NULL DEFAULT '0',
  204. ADD COLUMN ip_low6 smallint(255) unsigned NOT NULL DEFAULT '0',
  205. ADD COLUMN ip_high6 smallint(255) unsigned NOT NULL DEFAULT '0',
  206. ADD COLUMN ip_low7 smallint(255) unsigned NOT NULL DEFAULT '0',
  207. ADD COLUMN ip_high7 smallint(255) unsigned NOT NULL DEFAULT '0',
  208. ADD COLUMN ip_low8 smallint(255) unsigned NOT NULL DEFAULT '0',
  209. ADD COLUMN ip_high8 smallint(255) unsigned NOT NULL DEFAULT '0';
  210. ---#
  211. ---# Changing existing columns to ban items...
  212. ALTER TABLE {$db_prefix}ban_items
  213. CHANGE ip_low1 ip_low1 smallint(255) unsigned NOT NULL DEFAULT '0',
  214. CHANGE ip_high1 ip_high1 smallint(255) unsigned NOT NULL DEFAULT '0',
  215. CHANGE ip_low2 ip_low2 smallint(255) unsigned NOT NULL DEFAULT '0',
  216. CHANGE ip_high2 ip_high2 smallint(255) unsigned NOT NULL DEFAULT '0',
  217. CHANGE ip_low3 ip_low3 smallint(255) unsigned NOT NULL DEFAULT '0',
  218. CHANGE ip_high3 ip_high3 smallint(255) unsigned NOT NULL DEFAULT '0',
  219. CHANGE ip_low4 ip_low4 smallint(255) unsigned NOT NULL DEFAULT '0',
  220. CHANGE ip_high4 ip_high4 smallint(255) unsigned NOT NULL DEFAULT '0';
  221. ---#
  222. /******************************************************************************/
  223. --- Adding support for logging who fulfils a group request.
  224. /******************************************************************************/
  225. ---# Adding new columns to log_group_requests
  226. ALTER TABLE {$db_prefix}log_group_requests
  227. ADD COLUMN status tinyint(3) unsigned NOT NULL default '0',
  228. ADD COLUMN id_member_acted mediumint(8) unsigned NOT NULL default '0',
  229. ADD COLUMN member_name_acted varchar(255) NOT NULL default '',
  230. ADD COLUMN time_acted int(10) unsigned NOT NULL default '0',
  231. ADD COLUMN act_reason text NOT NULL;
  232. ---#
  233. ---# Adjusting the indexes for log_group_requests
  234. ALTER TABLE {$db_prefix}log_group_requests
  235. DROP INDEX `id_member`,
  236. ADD INDEX `id_member` (`id_member`, `id_group`);
  237. ---#
  238. /******************************************************************************/
  239. --- Adding support for <credits> tag in package manager
  240. /******************************************************************************/
  241. ---# Adding new columns to log_packages ..
  242. ALTER TABLE {$db_prefix}log_packages
  243. ADD COLUMN credits varchar(255) NOT NULL DEFAULT '';
  244. ---#
  245. /******************************************************************************/
  246. --- Adding more space for session ids
  247. /******************************************************************************/
  248. ---# Altering the session_id columns...
  249. ALTER TABLE {$db_prefix}log_online
  250. CHANGE `session` `session` varchar(64) NOT NULL DEFAULT '';
  251. ALTER TABLE {$db_prefix}log_errors
  252. CHANGE `session` `session` char(64) NOT NULL default ' ';
  253. ALTER TABLE {$db_prefix}sessions
  254. CHANGE `session_id` `session_id` char(64) NOT NULL;
  255. ---#
  256. /******************************************************************************/
  257. --- Adding support for MOVED topics enhancements
  258. /******************************************************************************/
  259. ---# Adding new columns to topics ..
  260. ALTER TABLE {$db_prefix}topics
  261. ADD COLUMN redirect_expires int(10) unsigned NOT NULL default '0',
  262. ADD COLUMN id_redirect_topic mediumint(8) unsigned NOT NULL default '0';
  263. ---#
  264. /******************************************************************************/
  265. --- Adding new scheduled tasks
  266. /******************************************************************************/
  267. ---# Adding new scheduled tasks
  268. INSERT INTO {$db_prefix}scheduled_tasks
  269. (next_time, time_offset, time_regularity, time_unit, disabled, task)
  270. VALUES
  271. (0, 120, 1, 'd', 0, 'remove_temp_attachments');
  272. INSERT INTO {$db_prefix}scheduled_tasks
  273. (next_time, time_offset, time_regularity, time_unit, disabled, task)
  274. VALUES
  275. (0, 180, 1, 'd', 0, 'remove_topic_redirect');
  276. INSERT INTO {$db_prefix}scheduled_tasks
  277. (next_time, time_offset, time_regularity, time_unit, disabled, task)
  278. VALUES
  279. (0, 240, 1, 'd', 0, 'remove_old_drafts');
  280. ---#
  281. /******************************************************************************/
  282. ---- Adding background tasks support
  283. /******************************************************************************/
  284. ---# Adding the new table
  285. CREATE TABLE IF NOT EXISTS {$db_prefix}background_tasks (
  286. id_task int(10) unsigned NOT NULL auto_increment,
  287. task_file varchar(255) NOT NULL default '',
  288. task_class varchar(255) NOT NULL default '',
  289. task_data mediumtext NOT NULL,
  290. claimed_time int(10) unsigned NOT NULL default '0',
  291. PRIMARY KEY (id_task)
  292. ) ENGINE=MyISAM;
  293. ---#
  294. /******************************************************************************/
  295. ---- Replacing MSN with Skype
  296. /******************************************************************************/
  297. ---# Modifying the "msn" column...
  298. ALTER TABLE {$db_prefix}members
  299. CHANGE msn skype varchar(255) NOT NULL DEFAULT '';
  300. ---#
  301. /******************************************************************************/
  302. --- Adding support for deny boards access
  303. /******************************************************************************/
  304. ---# Adding new columns to boards...
  305. ALTER TABLE {$db_prefix}boards
  306. ADD COLUMN deny_member_groups varchar(255) NOT NULL DEFAULT '';
  307. ---#
  308. /******************************************************************************/
  309. --- Updating board access rules
  310. /******************************************************************************/
  311. ---# Updating board access rules
  312. ---{
  313. $member_groups = array(
  314. 'allowed' => array(),
  315. 'denied' => array(),
  316. );
  317. $request = $smcFunc['db_query']('', '
  318. SELECT id_group, add_deny
  319. FROM {db_prefix}permissions
  320. WHERE permission = {string:permission}',
  321. array(
  322. 'permission' => 'manage_boards',
  323. )
  324. );
  325. while ($row = $smcFunc['db_fetch_assoc']($request))
  326. $member_groups[$row['add_deny'] === '1' ? 'allowed' : 'denied'][] = $row['id_group'];
  327. $smcFunc['db_free_result']($request);
  328. $member_groups = array_diff($member_groups['allowed'], $member_groups['denied']);
  329. if (!empty($member_groups))
  330. {
  331. $count = count($member_groups);
  332. $changes = array();
  333. $request = $smcFunc['db_query']('', '
  334. SELECT id_board, member_groups
  335. FROM {db_prefix}boards');
  336. while ($row = $smcFunc['db_fetch_assoc']($request))
  337. {
  338. $current_groups = explode(',', $row['member_groups']);
  339. if (count(array_intersect($current_groups, $member_groups)) != $count)
  340. {
  341. $new_groups = array_unique(array_merge($current_groups, $member_groups));
  342. $changes[$row['id_board']] = implode(',', $new_groups);
  343. }
  344. }
  345. $smcFunc['db_free_result']($request);
  346. if (!empty($changes))
  347. {
  348. foreach ($changes as $id_board => $member_groups)
  349. $smcFunc['db_query']('', '
  350. UPDATE {db_prefix}boards
  351. SET member_groups = {string:member_groups}
  352. WHERE id_board = {int:id_board}',
  353. array(
  354. 'member_groups' => $member_groups,
  355. 'id_board' => $id_board,
  356. )
  357. );
  358. }
  359. }
  360. ---}
  361. ---#
  362. /******************************************************************************/
  363. --- Adding support for category descriptions
  364. /******************************************************************************/
  365. ---# Adding new columns to categories...
  366. ALTER TABLE {$db_prefix}categories
  367. ADD COLUMN description text NOT NULL;
  368. ---#
  369. /******************************************************************************/
  370. --- Adding support for alerts
  371. /******************************************************************************/
  372. ---# Adding the count to the members table...
  373. ALTER TABLE {$db_prefix}members
  374. ADD COLUMN alerts int(10) unsigned NOT NULL default '0';
  375. ---#
  376. ---# Adding the new table for alerts.
  377. CREATE TABLE IF NOT EXISTS {$db_prefix}user_alerts (
  378. id_alert int(10) unsigned NOT NULL auto_increment,
  379. alert_time int(10) unsigned NOT NULL default '0',
  380. id_member mediumint(10) unsigned NOT NULL default '0',
  381. id_member_started mediumint(10) unsigned NOT NULL default '0',
  382. member_name varchar(255) NOT NULL default '',
  383. content_type varchar(255) NOT NULL default '',
  384. content_id int(10) unsigned NOT NULL default '0',
  385. content_action varchar(255) NOT NULL default '',
  386. is_read int(10) unsigned NOT NULL default '0',
  387. extra text NOT NULL,
  388. PRIMARY KEY (id_alert),
  389. KEY id_member (id_member),
  390. KEY alert_time (alert_time)
  391. ) ENGINE=MyISAM;
  392. ---#
  393. ---# Adding alert preferences.
  394. CREATE TABLE IF NOT EXISTS {$db_prefix}user_alerts_prefs (
  395. id_member mediumint(8) unsigned NOT NULL default '0',
  396. alert_pref varchar(32) NOT NULL default '',
  397. alert_value tinyint(3) NOT NULL default '0',
  398. PRIMARY KEY (id_member, alert_pref)
  399. ) ENGINE=MyISAM;
  400. INSERT INTO {$db_prefix}user_alerts_prefs
  401. (id_member, alert_pref, alert_value)
  402. VALUES (0, 'member_group_request', 1),
  403. (0, 'member_register', 1),
  404. (0, 'msg_like', 1),
  405. (0, 'msg_report', 1),
  406. (0, 'msg_report_reply', 1);
  407. ---#
  408. /******************************************************************************/
  409. --- Adding support for topic unwatch
  410. /******************************************************************************/
  411. ---# Adding new columns to boards...
  412. ALTER TABLE {$db_prefix}log_topics
  413. ADD COLUMN unwatched tinyint(3) NOT NULL DEFAULT '0';
  414. UPDATE {$db_prefix}log_topics
  415. SET unwatched = 0;
  416. INSERT INTO {$db_prefix}settings
  417. (variable, value)
  418. VALUES
  419. ('enable_unwatch', 0);
  420. ---#
  421. ---# Fixing column name change...
  422. ALTER TABLE {$db_prefix}log_topics
  423. CHANGE COLUMN disregarded unwatched tinyint(3) NOT NULL DEFAULT '0';
  424. ---#
  425. /******************************************************************************/
  426. --- Fixing mail queue for long messages
  427. /******************************************************************************/
  428. ---# Altering mil_queue table...
  429. ALTER TABLE {$db_prefix}mail_queue
  430. CHANGE body body mediumtext NOT NULL;
  431. ---#
  432. /******************************************************************************/
  433. --- Name changes
  434. /******************************************************************************/
  435. ---# Altering the membergroup stars to icons
  436. ALTER TABLE {$db_prefix}membergroups
  437. CHANGE `stars` `icons` varchar(255) NOT NULL DEFAULT '';
  438. ---#
  439. ---# Renaming default theme...
  440. UPDATE {$db_prefix}themes
  441. SET value = 'SMF Default Theme - Curve2'
  442. WHERE value LIKE 'SMF Default Theme%';
  443. ---#
  444. ---# Adding the enableThemes setting.
  445. INSERT INTO {$db_prefix}settings
  446. (variable, value)
  447. VALUES
  448. ('enableThemes', '1');
  449. ---#
  450. ---# Setting "default" as the default...
  451. UPDATE {$db_prefix}settings
  452. SET value = '1'
  453. WHERE variable = 'theme_guests';
  454. UPDATE {$db_prefix}boards
  455. SET id_theme = 0;
  456. UPDATE {$db_prefix}members
  457. SET id_theme = 0;
  458. ---#
  459. /******************************************************************************/
  460. --- Cleaning up after old themes...
  461. /******************************************************************************/
  462. ---# Checking for "core" and removing it if necessary...
  463. ---{
  464. // Do they have "core" installed?
  465. if (file_exists($GLOBALS['boarddir'] . '/Themes/core'))
  466. {
  467. $core_dir = $GLOBALS['boarddir'] . '/Themes/core';
  468. $theme_request = upgrade_query("
  469. SELECT id_theme
  470. FROM {$db_prefix}themes
  471. WHERE variable = 'theme_dir'
  472. AND value ='$core_dir'");
  473. // Don't do anything if this theme is already uninstalled
  474. if ($smcFunc['db_num_rows']($theme_request) == 1)
  475. {
  476. // Only one row, so no loop needed
  477. $row = $smcFunc['db_fetch_array']($theme_request);
  478. $id_theme = $row[0];
  479. $smcFunc['db_free_result']($theme_request);
  480. $known_themes = explode(', ', $modSettings['knownThemes']);
  481. // Remove this value...
  482. $known_themes = array_diff($known_themes, array($id_theme));
  483. // Change back to a string...
  484. $known_themes = implode(', ', $known_themes);
  485. // Update the database
  486. upgrade_query("
  487. REPLACE INTO {$db_prefix}settings (variable, value)
  488. VALUES ('knownThemes', '$known_themes')");
  489. // Delete any info about this theme
  490. upgrade_query("
  491. DELETE FROM {$db_prefix}themes
  492. WHERE id_theme = $id_theme");
  493. }
  494. }
  495. ---}
  496. ---#
  497. /******************************************************************************/
  498. --- Adding support for drafts
  499. /******************************************************************************/
  500. ---# Creating draft table
  501. CREATE TABLE IF NOT EXISTS {$db_prefix}user_drafts (
  502. id_draft int(10) unsigned NOT NULL auto_increment,
  503. id_topic mediumint(8) unsigned NOT NULL default '0',
  504. id_board smallint(5) unsigned NOT NULL default '0',
  505. id_reply int(10) unsigned NOT NULL default '0',
  506. type tinyint(4) NOT NULL default '0',
  507. poster_time int(10) unsigned NOT NULL default '0',
  508. id_member mediumint(8) unsigned NOT NULL default '0',
  509. subject varchar(255) NOT NULL default '',
  510. smileys_enabled tinyint(4) NOT NULL default '1',
  511. body mediumtext NOT NULL,
  512. icon varchar(16) NOT NULL default 'xx',
  513. locked tinyint(4) NOT NULL default '0',
  514. is_sticky tinyint(4) NOT NULL default '0',
  515. to_list varchar(255) NOT NULL default '',
  516. PRIMARY KEY id_draft(id_draft),
  517. UNIQUE id_member (id_member, id_draft, type)
  518. ) ENGINE=MyISAM{$db_collation};
  519. ---#
  520. ---# Adding draft permissions...
  521. ---{
  522. // We cannot do this twice
  523. if (@$modSettings['smfVersion'] < '2.1')
  524. {
  525. // Anyone who can currently post unapproved topics we assume can create drafts as well ...
  526. $request = upgrade_query("
  527. SELECT id_group, id_board, add_deny, permission
  528. FROM {$db_prefix}board_permissions
  529. WHERE permission = 'post_unapproved_topics'");
  530. $inserts = array();
  531. while ($row = $smcFunc['db_fetch_assoc']($request))
  532. {
  533. $inserts[] = "($row[id_group], $row[id_board], 'post_draft', $row[add_deny])";
  534. $inserts[] = "($row[id_group], $row[id_board], 'post_autosave_draft', $row[add_deny])";
  535. }
  536. $smcFunc['db_free_result']($request);
  537. if (!empty($inserts))
  538. upgrade_query("
  539. INSERT IGNORE INTO {$db_prefix}board_permissions
  540. (id_group, id_board, permission, add_deny)
  541. VALUES
  542. " . implode(',', $inserts));
  543. // Next we find people who can send PMs, and assume they can save pm_drafts as well
  544. $request = upgrade_query("
  545. SELECT id_group, add_deny, permission
  546. FROM {$db_prefix}permissions
  547. WHERE permission = 'pm_send'");
  548. $inserts = array();
  549. while ($row = $smcFunc['db_fetch_assoc']($request))
  550. {
  551. $inserts[] = "($row[id_group], 'pm_draft', $row[add_deny])";
  552. $inserts[] = "($row[id_group], 'pm_autosave_draft', $row[add_deny])";
  553. }
  554. $smcFunc['db_free_result']($request);
  555. if (!empty($inserts))
  556. upgrade_query("
  557. INSERT IGNORE INTO {$db_prefix}permissions
  558. (id_group, permission, add_deny)
  559. VALUES
  560. " . implode(',', $inserts));
  561. }
  562. ---}
  563. INSERT INTO {$db_prefix}settings
  564. (variable, value)
  565. VALUES
  566. ('drafts_autosave_enabled', '1'),
  567. ('drafts_show_saved_enabled', '1'),
  568. ('drafts_keep_days', '7');
  569. INSERT INTO {$db_prefix}themes
  570. (id_theme, variable, value)
  571. VALUES
  572. ('1', 'drafts_autosave_enabled', '1'),
  573. ('1', 'drafts_show_saved_enabled', '1');
  574. ---#
  575. /******************************************************************************/
  576. --- Adding support for likes
  577. /******************************************************************************/
  578. ---# Creating likes table.
  579. CREATE TABLE IF NOT EXISTS {$db_prefix}user_likes (
  580. id_member mediumint(8) unsigned NOT NULL default '0',
  581. content_type char(6) default '',
  582. content_id int(10) unsigned NOT NULL default '0',
  583. like_time int(10) unsigned NOT NULL default '0',
  584. PRIMARY KEY (content_id, content_type, id_member),
  585. INDEX content (content_id, content_type),
  586. INDEX liker (id_member)
  587. ) ENGINE=MyISAM;
  588. ---#
  589. ---# Adding count to the messages table.
  590. ALTER TABLE {$db_prefix}messages
  591. ADD COLUMN likes smallint(5) unsigned NOT NULL DEFAULT '0';
  592. ---#
  593. /******************************************************************************/
  594. --- Adding support for group-based board moderation
  595. /******************************************************************************/
  596. ---# Creating moderator_groups table
  597. CREATE TABLE IF NOT EXISTS {$db_prefix}moderator_groups (
  598. id_board smallint(5) unsigned NOT NULL default '0',
  599. id_group smallint(5) unsigned NOT NULL default '0',
  600. PRIMARY KEY (id_board, id_group)
  601. ) ENGINE=MyISAM{$db_collation};
  602. ---#
  603. /******************************************************************************/
  604. --- Cleaning up integration hooks
  605. /******************************************************************************/
  606. ---# Deleting integration hooks
  607. DELETE FROM {$db_prefix}settings
  608. WHERE variable LIKE 'integrate_%';
  609. ---#
  610. /******************************************************************************/
  611. --- Cleaning up old settings
  612. /******************************************************************************/
  613. ---# Updating the default time format
  614. ---{
  615. if (!empty($modSettings['time_format']))
  616. {
  617. // First, use the shortened form of the month in the date.
  618. $time_format = str_replace('%B', '%b', $modSettings['time_format']);
  619. // Second, shorten the time to stop including seconds.
  620. $time_format = str_replace(':%S', '', $time_format);
  621. // Then, update the database.
  622. $smcFunc['db_query']('', '
  623. UPDATE {db_prefix}settings
  624. SET value = {string:new_format}
  625. WHERE variable = {literal:time_format}',
  626. array(
  627. 'new_format' => $time_format,
  628. )
  629. );
  630. }
  631. ---}
  632. ---#
  633. ---# Fixing a deprecated option.
  634. UPDATE {$db_prefix}settings
  635. SET value = 'option_css_resize'
  636. WHERE variable = 'avatar_action_too_large'
  637. AND (value = 'option_html_resize' OR value = 'option_js_resize');
  638. ---#
  639. ---# Cleaning up the old Core Features page.
  640. ---{
  641. // First get the original value
  642. $request = $smcFunc['db_query']('', '
  643. SELECT value
  644. FROM {db_prefix}settings
  645. WHERE variable = {literal:admin_features}');
  646. if ($smcFunc['db_num_rows']($request) > 0 && $row = $smcFunc['db_fetch_assoc']($request))
  647. {
  648. // Some of these *should* already be set but you never know.
  649. $new_settings = array();
  650. $admin_features = explode(',', $row['value']);
  651. // Now, let's just recap something.
  652. // cd = calendar, should also have set cal_enabled already
  653. // cp = custom profile fields, which already has several fields that cover tracking
  654. // k = karma, should also have set karmaMode already
  655. // ps = paid subs, should also have set paid_enabled already
  656. // rg = reports generation, which is now permanently on
  657. // sp = spider tracking, should also have set spider_mode already
  658. // w = warning system, which will be covered with warning_settings
  659. // The rest we have to deal with manually.
  660. // Moderation log - modlog_enabled itself should be set but we have others now
  661. if (in_array('ml', $admin_features))
  662. {
  663. $new_settings[] = array('adminlog_enabled', '1');
  664. $new_settings[] = array('userlog_enabled', '1');
  665. }
  666. // Post moderation
  667. if (in_array('pm', $admin_features))
  668. {
  669. $new_settings[] = array('postmod_active', '1');
  670. }
  671. // And now actually apply it.
  672. if (!empty($new_settings))
  673. {
  674. $smcFunc['db_insert']('replace',
  675. '{db_prefix}settings',
  676. array('variable' => 'string', 'value' => 'string'),
  677. $new_settings,
  678. array('variable')
  679. );
  680. }
  681. }
  682. $smcFunc['db_free_result']($request);
  683. ---}
  684. ---#
  685. ---# Cleaning up old settings.
  686. DELETE FROM {$db_prefix}settings
  687. WHERE variable IN ('enableStickyTopics', 'guest_hideContacts', 'notify_new_registration', 'attachmentEncryptFilenames', 'hotTopicPosts', 'hotTopicVeryPosts', 'fixLongWords', 'admin_features', 'topbottomEnable', 'simpleSearch', 'enableVBStyleLogin');
  688. ---#
  689. ---# Cleaning up old theme settings.
  690. DELETE FROM {$db_prefix}themes
  691. WHERE variable IN ('show_board_desc', 'no_new_reply_warning', 'display_quick_reply', 'show_mark_read', 'show_member_bar', 'linktree_link');
  692. ---#
  693. /******************************************************************************/
  694. --- Updating files that fetched from simplemachines.org
  695. /******************************************************************************/
  696. ---# We no longer call on several files.
  697. DELETE FROM {$db_prefix}admin_info_files
  698. WHERE filename IN ('latest-packages.js', 'latest-support.js', 'latest-themes.js')
  699. AND path = '/smf/';
  700. ---#
  701. ---# But we do need new files.
  702. ---{
  703. $smcFunc['db_insert']('',
  704. '{db_prefix}admin_info_files',
  705. array('filename' => 'string', 'path' => 'string', 'parameters' => 'string', 'data' => 'string', 'filetype' => 'string'),
  706. array('latest-versions.txt', '/smf/', 'version=%3$s', '', 'text/plain'),
  707. array('id_file')
  708. );
  709. ---}
  710. ---#
  711. /******************************************************************************/
  712. --- Upgrading "verification questions" feature
  713. /******************************************************************************/
  714. ---# Creating qanda table
  715. CREATE TABLE IF NOT EXISTS {$db_prefix}qanda (
  716. id_question smallint(5) unsigned NOT NULL auto_increment,
  717. lngfile varchar(255) NOT NULL default '',
  718. question varchar(255) NOT NULL default '',
  719. answers text NOT NULL,
  720. PRIMARY KEY (id_question),
  721. KEY lngfile (lngfile)
  722. ) ENGINE=MyISAM{$db_collation};
  723. ---#
  724. ---# Moving questions and answers to the new table
  725. ---{
  726. $questions = array();
  727. $get_questions = upgrade_query("
  728. SELECT body AS question, recipient_name AS answer
  729. FROM {$db_prefix}log_comments
  730. WHERE comment_type = 'ver_test'");
  731. while ($row = $smcFunc['db_fetch_assoc']($get_questions))
  732. $questions[] = array($language, $row['question'], serialize(array($row['answer'])));
  733. $smcFunc['db_free_result']($get_questions);
  734. if (!empty($questions))
  735. {
  736. $smcFunc['db_insert']('',
  737. '{db_prefix}qanda',
  738. array('lngfile' => 'string', 'question' => 'string', 'answers' => 'string'),
  739. $questions,
  740. array('id_question')
  741. );
  742. // Delete the questions from log_comments now
  743. upgrade_query("
  744. DELETE FROM {$db_prefix}log_comments
  745. WHERE comment_type = 'ver_test'
  746. ");
  747. }
  748. ---}
  749. ---#
  750. /******************************************************************************/
  751. --- Marking packages as uninstalled...
  752. /******************************************************************************/
  753. ---# Updating log_packages
  754. UPDATE {$db_prefix}log_packages
  755. SET install_state = 0;
  756. ---#
  757. /******************************************************************************/
  758. --- Updating profile permissions...
  759. /******************************************************************************/
  760. ---# Removing the old "view your own profile" permission
  761. DELETE FROM {$db_prefix}permissions
  762. WHERE permission = 'profile_view_own';
  763. ---#
  764. ---# Updating the old "view any profile" permission
  765. UPDATE {$db_prefix}permissions
  766. SET permission = 'profile_view'
  767. WHERE permission = 'profile_view_any';
  768. ---#
  769. ---# Removing the old notification permissions
  770. DELETE FROM {$db_prefix}board_permissions
  771. WHERE permission = 'mark_notify' OR permission = 'mark_any_notify';
  772. ---#
  773. ---# Removing the send-topic permission
  774. DELETE FROM {$db_prefix}board_permissions
  775. WHERE permission = 'send_topic';
  776. ---#
  777. ---# Adding "profile_password_own"
  778. ---{
  779. $inserts = array();
  780. $request = upgrade_query("
  781. SELECT id_group, add_deny
  782. FROM {$db_prefix}permissions
  783. WHERE permission = 'profile_identity_own'");
  784. while ($row = $smcFunc['db_fetch_assoc']($request))
  785. {
  786. $inserts[] = "($row[id_group], 'profile_password_own', $row[add_deny])";
  787. }
  788. $smcFunc['db_free_result']($request);
  789. if (!empty($inserts))
  790. {
  791. upgrade_query("
  792. INSERT INTO {$db_prefix}permissions
  793. (id_group, permission, add_deny)
  794. VALUES
  795. " . implode(',', $inserts)
  796. );
  797. }
  798. ---}
  799. ---#
  800. ---# Adding other profile permissions
  801. ---{
  802. $inserts = array();
  803. $request = upgrade_query("
  804. SELECT id_group, add_deny
  805. FROM {$db_prefix}permissions
  806. WHERE permission = 'profile_extra_own'");
  807. while ($row = $smcFunc['db_fetch_assoc']($request))
  808. {
  809. $inserts[] = "($row[id_group], 'profile_blurb_own', $row[add_deny])";
  810. $inserts[] = "($row[id_group], 'profile_displayed_name_own', $row[add_deny])";
  811. $inserts[] = "($row[id_group], 'profile_forum_own', $row[add_deny])";
  812. $inserts[] = "($row[id_group], 'profile_other_own', $row[add_deny])";
  813. $inserts[] = "($row[id_group], 'profile_signature_own', $row[add_deny])";
  814. }
  815. $smcFunc['db_free_result']($request);
  816. if (!empty($inserts))
  817. {
  818. upgrade_query("
  819. INSERT INTO {$db_prefix}permissions
  820. (id_group, permission, add_deny)
  821. VALUES
  822. " . implode(',', $inserts)
  823. );
  824. }
  825. ---}
  826. ---#
  827. /******************************************************************************/
  828. --- Upgrading PM labels...
  829. /******************************************************************************/
  830. ---# Adding pm_labels table...
  831. CREATE TABLE IF NOT EXISTS {$db_prefix}pm_labels (
  832. id_label int(10) unsigned NOT NULL auto_increment,
  833. id_member mediumint(8) unsigned NOT NULL default '0',
  834. name varchar(30) NOT NULL default '',
  835. PRIMARY KEY (id_label)
  836. ) ENGINE=MyISAM;
  837. ---#
  838. ---# Adding pm_labeled_messages table...
  839. CREATE TABLE IF NOT EXISTS {$db_prefix}pm_labeled_messages (
  840. id_label int(10) unsigned NOT NULL default '0',
  841. id_pm int(10) unsigned NOT NULL default '0',
  842. PRIMARY KEY (id_label, id_pm)
  843. ) ENGINE=MyISAM;
  844. ---#
  845. ---# Adding "in_inbox" column to pm_recipients
  846. ALTER TABLE {$db_prefix}pm_recipients
  847. ADD COLUMN in_inbox tinyint(3) NOT NULL default '1';
  848. ---#
  849. ---# Moving label info to new tables and updating rules...
  850. ---{
  851. // First see if we still have a message_labels column
  852. $results = $smcFunc['db_list_columns']('{db_prefix}members');
  853. if (in_array('message_labels', $results))
  854. {
  855. // They've still got it, so pull the label info
  856. $get_labels = $smcFunc['db_query']('', '
  857. SELECT id_member, message_labels
  858. FROM {db_prefix}members
  859. WHERE message_labels != {string:blank}',
  860. array(
  861. 'blank' => '',
  862. )
  863. );
  864. $inserts = array();
  865. $label_info = array();
  866. while ($row = $smcFunc['db_fetch_assoc']($get_labels))
  867. {
  868. // Stick this in an array
  869. $labels = explode(',', $row['message_labels']);
  870. // Build some inserts
  871. foreach ($labels AS $index => $label)
  872. {
  873. // Keep track of the index of this label - we'll need that in a bit...
  874. $label_info[$row['id_member']][$label] = $index;
  875. $inserts[] = array($row['id_member'], $label);
  876. }
  877. }
  878. $smcFunc['db_free_result']($get_labels);
  879. if (!empty($inserts))
  880. {
  881. $smcFunc['db_insert']('', '{db_prefix}pm_labels', array('id_member' => 'int', 'name' => 'string-30'), $inserts, array());
  882. // Clear this out for our next query below
  883. $inserts = array();
  884. }
  885. // This is the easy part - update the inbox stuff
  886. $smcFunc['db_query']('', '
  887. UPDATE {db_prefix}pm_recipients
  888. SET in_inbox = {int:in_inbox}
  889. WHERE FIND_IN_SET({int:minusone}, labels)',
  890. array(
  891. 'in_inbox' => 1,
  892. 'minusone' => -1,
  893. )
  894. );
  895. // Now we go pull the new IDs for each label
  896. $get_new_label_ids = $smcFunc['db_query']('', '
  897. SELECT *
  898. FROM {db_prefix}pm_labels',
  899. array(
  900. )
  901. );
  902. $label_info_2 = array();
  903. while ($label_row = $smcFunc['db_fetch_assoc']($get_new_label_ids))
  904. {
  905. // Map the old index values to the new ID values...
  906. $old_index = $label_info[$row['id_member']][$row['label_name']];
  907. $label_info_2[$row['id_member']][$old_index] = $row['id_label'];
  908. }
  909. $smcFunc['db_free_result']($get_new_label_ids);
  910. // Pull label info from pm_recipients
  911. // Ignore any that are only in the inbox
  912. $get_pm_labels = $smcFunc['db_query']('', '
  913. SELECT id_pm, id_member, labels
  914. FROM {db_prefix}pm_recipients
  915. WHERE deleted = {int:not_deleted}
  916. AND labels != {string:minus_one}',
  917. array(
  918. 'not_deleted' => 0,
  919. 'minus_one' => -1,
  920. )
  921. );
  922. while ($row = $smcFunc['db_fetch_assoc']($get_pm_labels))
  923. {
  924. $labels = explode(',', $row['labels']);
  925. foreach ($labels as $a_label)
  926. {
  927. if ($a_label == '-1')
  928. continue;
  929. $new_label_info = $label_info_2[$row['id_member']][$a_label];
  930. $inserts[] = array($row['id_pm'], $new_label_info);
  931. }
  932. }
  933. $smcFunc['db_free_result']($get_pm_labels);
  934. // Insert the new data
  935. if (!empty($inserts))
  936. {
  937. $smcFunc['db_insert']('', '{db_prefix}pm_labeled_messages', array('id_pm' => 'int', 'id_label' => 'int'), $inserts, array());
  938. }
  939. // Final step of this ridiculously massive process
  940. $get_pm_rules = $smcFunc['db_query']('', '
  941. SELECT id_member, id_rule, actions
  942. FROM {db_prefix}pm_rules',
  943. array(
  944. )
  945. );
  946. // Go through the rules, unserialize the actions, then figure out if there's anything we can use
  947. while ($row = $smcFunc['db_fetch_assoc']($get_pm_rules))
  948. {
  949. // Turn this into an array...
  950. $actions = unserialize($row['actions']);
  951. // Loop through the actions and see if we're applying a label anywhere
  952. foreach ($actions as $index => $action)
  953. {
  954. if ($action['t'] == 'lab')
  955. {
  956. // Update the value of this label...
  957. $actions[$index]['v'] = $label_info_2[$row['id_member']][$action['v']];
  958. }
  959. }
  960. // Put this back into a string
  961. $actions = serialize($actions);
  962. $smcFunc['db_query']('', '
  963. UPDATE {db_prefix}pm_rules
  964. SET actions = {string:actions}
  965. WHERE id_rule = {int:id_rule}',
  966. array(
  967. 'actions' => $actions,
  968. 'id_rule' => $row['id_rule'],
  969. )
  970. );
  971. }
  972. $smcFunc['db_free_result']($get_pm_rules);
  973. // Lastly, we drop the old columns
  974. $smcFunc['db_remove_column']('{db_prefix}members', 'message_labels');
  975. $smcFunc['db_remove_column']('{db_prefix}pm_recipients', 'labels');
  976. }
  977. ---}
  978. ---#
  979. /******************************************************************************/
  980. --- Adding support for edit reasons
  981. /******************************************************************************/
  982. ---# Adding "modified_reason" column to messages
  983. ALTER TABLE {$db_prefix}messages
  984. ADD COLUMN modified_reason varchar(255) NOT NULL default '';
  985. ---#
  986. /******************************************************************************/
  987. --- Cleaning up guest permissions
  988. /******************************************************************************/
  989. ---# Removing permissions guests can no longer have...
  990. ---{
  991. $illegal_board_permissions = array(
  992. 'announce_topic',
  993. 'delete_any',
  994. 'lock_any',
  995. 'make_sticky',
  996. 'merge_any',
  997. 'modify_any',
  998. 'modify_replies',
  999. 'move_any',
  1000. 'poll_add_any',
  1001. 'poll_edit_any',
  1002. 'poll_lock_any',
  1003. 'poll_remove_any',
  1004. 'remove_any',
  1005. 'report_any',
  1006. 'split_any'
  1007. );
  1008. $illegal_permissions = array('calendar_edit_any', 'moderate_board', 'moderate_forum', 'send_email_to_members');
  1009. $smcFunc['db_query']('', '
  1010. DELETE FROM {db_prefix}board_permissions
  1011. WHERE id_group = {int:guests}
  1012. AND permission IN ({array_string:illegal_board_perms})',
  1013. array(
  1014. 'guests' => -1,
  1015. 'illegal_board_perms' => $illegal_board_permissions,
  1016. )
  1017. );
  1018. $smcFunc['db_query']('', '
  1019. DELETE FROM {db_prefix}permissions
  1020. WHERE id_group = {int:guests}
  1021. AND permission IN ({array_string:illegal_perms})',
  1022. array(
  1023. 'guests' => -1,
  1024. 'illegal_perms' => $illegal_permissions,
  1025. )
  1026. );
  1027. ---}
  1028. ---#
  1029. /******************************************************************************/
  1030. --- Adding mail queue settings
  1031. /******************************************************************************/
  1032. ---#
  1033. ---{
  1034. if (empty($modSettings['mail_limit']))
  1035. {
  1036. $smcFunc['db_insert']('replace',
  1037. '{db_prefix}settings',
  1038. array('variable' => 'string-255', 'value' => 'string'),
  1039. array(
  1040. array('mail_limit', '5'),
  1041. array('mail_quantity', '5'),
  1042. ),
  1043. array('variable')
  1044. );
  1045. }
  1046. ---}
  1047. ---#