Index: trunk/phase3/maintenance/tables.sql |
— | — | @@ -86,12 +86,6 @@ |
87 | 87 | -- Same with passwords. |
88 | 88 | user_email tinytext NOT NULL, |
89 | 89 | |
90 | | - -- Newline-separated list of name=value defining the user |
91 | | - -- preferences |
92 | | - -- Now obsolete in favour of user_properties table; |
93 | | - -- old values will be migrated from here transparently. |
94 | | - user_options blob NOT NULL, |
95 | | - |
96 | 90 | -- This is a timestamp which is updated when a user |
97 | 91 | -- logs in, logs out, changes preferences, or performs |
98 | 92 | -- some other action requiring HTML cache invalidation |
— | — | @@ -1493,7 +1487,7 @@ |
1494 | 1488 | |
1495 | 1489 | -- The namespace of the calling page on the remote wiki |
1496 | 1490 | -- Needed for display purposes, since the foreign namespace ID doesn't necessarily match a local one |
1497 | | - -- The link between the namespace and the namespace name is made by the globalnamespaces table |
| 1491 | + -- The link between the namespace and the namespace name is made by the globalnamespaces table |
1498 | 1492 | gtl_from_namespace int NOT NULL, |
1499 | 1493 | |
1500 | 1494 | -- The title of the calling page on the remote wiki |
Index: trunk/phase3/maintenance/archives/patch-drop-user_options.sql |
— | — | @@ -0,0 +1 @@ |
| 2 | +ALTER TABLE /*_*/user DROP COLUMN user_options; |
\ No newline at end of file |
Property changes on: trunk/phase3/maintenance/archives/patch-drop-user_options.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 3 | + native |
Index: trunk/phase3/maintenance/convertUserOptions.php |
— | — | @@ -37,23 +37,34 @@ |
38 | 38 | $id = 0; |
39 | 39 | $dbw = wfGetDB( DB_MASTER ); |
40 | 40 | |
| 41 | + if ( !$dbw->fieldExists( 'user', 'user_options ' ) ) { |
| 42 | + $this->output( "No user_options field in the user table. Nothing to migrate" ); |
| 43 | + return; |
| 44 | + } |
41 | 45 | while ( $id !== null ) { |
42 | | - $idCond = 'user_id>' . $dbw->addQuotes( $id ); |
43 | | - $optCond = "user_options!=" . $dbw->addQuotes( '' ); // For compatibility |
| 46 | + $idCond = 'user_id > ' . $dbw->addQuotes( $id ); |
| 47 | + $optCond = "user_options != " . $dbw->addQuotes( '' ); // For compatibility |
44 | 48 | $res = $dbw->select( 'user', '*', |
45 | | - array( $optCond, $idCond ), __METHOD__, |
46 | | - array( 'LIMIT' => 50, 'FOR UPDATE' ) ); |
| 49 | + array( $optCond, $idCond ), __METHOD__, |
| 50 | + array( 'LIMIT' => 50, 'FOR UPDATE' ) |
| 51 | + ); |
47 | 52 | $id = $this->convertOptionBatch( $res, $dbw ); |
48 | 53 | $dbw->commit(); |
49 | 54 | |
50 | 55 | wfWaitForSlaves(); |
51 | 56 | |
52 | | - if ( $id ) |
| 57 | + if ( $id ) { |
53 | 58 | $this->output( "--Converted to ID $id\n" ); |
| 59 | + } |
54 | 60 | } |
55 | 61 | $this->output( "Conversion done. Converted " . $this->mConversionCount . " user records.\n" ); |
56 | 62 | } |
57 | 63 | |
| 64 | + /** |
| 65 | + * @param $res |
| 66 | + * @param $dbw DatabaseBase |
| 67 | + * @return null|int |
| 68 | + */ |
58 | 69 | function convertOptionBatch( $res, $dbw ) { |
59 | 70 | $id = null; |
60 | 71 | foreach ( $res as $row ) { |
— | — | @@ -62,6 +73,14 @@ |
63 | 74 | $u = User::newFromRow( $row ); |
64 | 75 | |
65 | 76 | $u->saveSettings(); |
| 77 | + |
| 78 | + // Do this here as saveSettings() doesn't set user_options to '' anymore! |
| 79 | + $dbw->update( |
| 80 | + 'user', |
| 81 | + array( 'user_options' => '' ), |
| 82 | + array( 'user_id' => $row->user_id ), |
| 83 | + __METHOD__ |
| 84 | + ); |
66 | 85 | $id = $row->user_id; |
67 | 86 | } |
68 | 87 | |
Index: trunk/phase3/tests/selenium/data/SimpleSeleniumTestDB.sql |
— | — | @@ -1295,7 +1295,6 @@ |
1296 | 1296 | `user_newpassword` tinyblob NOT NULL, |
1297 | 1297 | `user_newpass_time` binary(14) DEFAULT NULL, |
1298 | 1298 | `user_email` tinytext NOT NULL, |
1299 | | - `user_options` blob NOT NULL, |
1300 | 1299 | `user_touched` binary(14) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0', |
1301 | 1300 | `user_token` binary(32) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', |
1302 | 1301 | `user_email_authenticated` binary(14) DEFAULT NULL, |
Index: trunk/phase3/tests/selenium/data/mediawiki118_fresh_installation.sql |
— | — | @@ -767,13 +767,13 @@ |
768 | 768 | |
769 | 769 | LOCK TABLES `mw_objectcache` WRITE; |
770 | 770 | /*!40000 ALTER TABLE `mw_objectcache` DISABLE KEYS */; |
771 | | -INSERT INTO `mw_objectcache` VALUES ('test_wiki-mw_:messages:en','K�2��.�2�R\ns\r\n���S�δ2��\0','2010-12-31 13:16:31'); |
772 | | -INSERT INTO `mw_objectcache` VALUES ('test_wiki-mw_:pcache:idhash:1-0!*!*!!en!*','�V[o�F�g~�����B��P��m)$TK�U��\0�����8$��9�a\rI�l��X>��ܹ�q�Sa,��ʕ�x��?[~ʃ|�.Z��$�8Y�\'�I�Y�K��-\04�U����J�\'&�uB)�:I������E�m�sk`�`k�Q�v��a���\rZ��t�0����+P%GE�ـ�JX;\n-s�P�@�B�b���8~�첒$��ea�υ��f����+���0[,�F�x��d�\'�z�0��BJ����=�����J��c�\\��:��&B��T��\'��C��Fdÿ׆Fq����Gd����%8G�0��A�I��; Ԙ`�7�5�LI\r��(���{�c�����g+��8Qr��&�ͦ��A)�V��ЕPT��\\UƧtn��Z�e�SfJZ(V�P�}�����0���O�N �=j�\\H��y�\\�U[h]T:���bd��u��+�j%\'�6k��f:E�;�@Yך��4���Ȁ��q���Z�º6<b�3��TU(d��,\n���Y|�e�\'�5��T�fU�8}�\"��m���/���}Uk�9o��;����|*R?�n��� 3d��g1��y�\\f8gk�����w��=��:/Y7���ۋ�^<�Ō�����v#���i����C�#���6\Z�.0�Ua$4�=\Z���;��4����Y=���5���:kpΐq��Ŧ4��X���C��qYߵ-��Lj�����D�f�����:����(3t��14C��J�#����������WXT���Δy:�^�6�v�7����I�U�Ee��(�p0��ga�6Mj��Sc�,ѫ@��ޅ+R����A���xХ\'6���utǷbۛ��`j�8ؚ�G�IC<KS��5�|�krJ\ry�\\b3xP�����ua�@����$SS�`��tQ.gwW��\r@\'���w�� ��xZ(�>5{����dw�>�=J)\r�6t ��X����M���B�\n�ŖT����b>�qg����7��z�n7��vwr�-%u�-Qi�iX1��Ne���A#�v��ӧ�3��?','2010-12-31 13:16:31'); |
773 | | -INSERT INTO `mw_objectcache` VALUES ('test_wiki-mw_:pcache:idoptions:1','E���@D��`�\"v�ƣ��Wh��,�b�!���⭙7�L+�|}�t��I�$�<���F\rpSl�4����OJN`\r\Z����ծ���)��PY��$�K����գ9�Vjp72��E���c�Wp�2��cVxu7�� ����p#�r=.���[>y)Zp��','2010-12-31 13:16:31'); |
774 | | -INSERT INTO `mw_objectcache` VALUES ('test_wiki-mw_:resourceloader:filter:minify-css:3832ee25d9c44988461f5f339b9b6a48','+�26�Rr�MM�LTH�ɩV\0�Z(��(3�(R�d\r\0','2038-01-19 03:14:07'); |
775 | | -INSERT INTO `mw_objectcache` VALUES ('test_wiki-mw_:resourceloader:filter:minify-css:aa0df16258ad99a1d249e796b5067ed9','+�2��Rr�MM�LTH�ɩN��K-�Q.,�L�NJ,R\0��s�\r���V�\Z\0','2038-01-19 03:14:07'); |
776 | | -INSERT INTO `mw_objectcache` VALUES ('test_wiki-mw_:resourceloader:filter:minify-js:22814eeadc9cf0a9ebcd844e14198e66','m��r�0��y����r�&Qޡמ!\n�qQ�Xq;}���$��ވ� �c!]]].o5S�\n�)Fq��L^���?�s�F�!�O�M\\�������\0���N��Ɂ���լ����:��-�j��F��{ۅ�G�\"i��� \Z�6�K����!��Y]=�F[�~竍���䶃����`��9N�Ǵ���@�K���|z����1�A��@J#_ԁ�7\'�l�1)J�͵�).�3z�f�T�A���Hњ�[#)�BzRA�7��\"T�*~SW���/P���B�Ŏ;\Z�ay�6�����+U��?.$�6��-uT�v@h��s�&�����Nإb�fJ�~�]6��p��/q)�>�E�1��͔A\ne�L�g\ZE�`cW�����`fJ�E�a��>��b\n�ӑd�.u�do��[�\nt��b�+���l\Z?X*��Y�(�օ;�L�Jqťɝ���d$�\"�WzG��-@b~+�#�kǞَ�Ƃ~������P)B �����q�Җ2���r�Rl����`z �4�����ÝX�m�;�X݁t;r.�sA��R��y)�kA�\nR�JT��J�U��*�W��_ߟ�4@�vt��f���>����x���','2038-01-19 03:14:07'); |
777 | | -INSERT INTO `mw_objectcache` VALUES ('test_wiki-mw_:resourceloader:filter:minify-js:dd9440c19c575629ac5ec90e489cf62e','+�21�R���Ԕ�����L���Ĕ�\"��ĒT�j��̒T%+���ĔJ�ZMk.%k\0','2038-01-19 03:14:07'); |
| 771 | +INSERT INTO `mw_objectcache` VALUES ('test_wiki-mw_:messages:en','K�2��.�2�R\ns\r\n���S�δ2��\0','2010-12-31 13:16:31'); |
| 772 | +INSERT INTO `mw_objectcache` VALUES ('test_wiki-mw_:pcache:idhash:1-0!*!*!!en!*','�V[o�F�g~�����B��P��m)$TK�U��\0�����8$��9�a\rI�l��X>��ܹ�q�Sa,��ʕ�x��?[~ʃ|�.Z��$�8Y�\'�I�Y�K��-\04�U����J�\'&�uB)�:I������E�m�sk`�`k�Q�v��a���\rZ��t�0����+P%GE�ـ�JX;\n-s�P�@�B�b���8~�첒$��ea�υ��f��+���0[,�F�x��d�\'�z�0��BJ���=���J��c�\\��:��&B��T��\'��C��Fdÿ׆Fq����Gd����%8G�0��A�I��; Ԙ`�7�5�LI\r��(���{�c�����g+��8Qr�&�ͦ��A)�V��ЕPT��\\UƧtn��Z�e�SfJZ(V�P�}����0��O�N �=j�\\H��y�\\�U[h]T:���bd��u��+�j%\'�6k��f:E�;�@Yך��4���Ȁ��q���Z�º6<b�3��TU(d��,\n���Y|�e�\'�5��T�fU�8}�\"��m���/���}Uk�9o��;����|*R?�n��� 3d��g1��y�\\f8gk�����w��=��:/Y7���ۋ�^<�Ō����v#���i����C�#��6\Z�.0�Ua$4�=\Z���;��4����Y=���5���:kpΐq��Ŧ4��X���C��qYߵ-��Lj�����D�f�����:����(3t��14C��J�#����������WXT���Δy:�^�6�v�7����I�U�Ee��(�p0��ga�6Mj��Sc�,ѫ@��ޅ+R����A��xХ\'6���utǷbۛ��`j�8ؚ�G�IC<KS��5�|�krJ\ry�\\b3xP�����ua�@����$SS�`��tQ.gwW��\r@\'���w�� ��xZ(�>5{����dw�>�=J)\r�6t ��X����M���B�\n�ŖT����b>�qg����7��z�n7��vwr�-%u�-Qi�iX1��Ne���A#�v��ӧ�3��?','2010-12-31 13:16:31'); |
| 773 | +INSERT INTO `mw_objectcache` VALUES ('test_wiki-mw_:pcache:idoptions:1','E���@D��`�\"v�ƣ��Wh��,�b�!�⭙7�L+�|}�t��I�$�<���F\rpSl�4����OJN`\r\Z����ծ���)��PY��$�K����գ9�Vjp72��E���c�Wp�2��cVxu7�� ����p#�r=.���[>y)Zp��','2010-12-31 13:16:31'); |
| 774 | +INSERT INTO `mw_objectcache` VALUES ('test_wiki-mw_:resourceloader:filter:minify-css:3832ee25d9c44988461f5f339b9b6a48','+�26�Rr�MM�LTH�ɩV\0�Z(��(3�(R�d\r\0','2038-01-19 03:14:07'); |
| 775 | +INSERT INTO `mw_objectcache` VALUES ('test_wiki-mw_:resourceloader:filter:minify-css:aa0df16258ad99a1d249e796b5067ed9','+�2��Rr�MM�LTH�ɩN��K-�Q.,�L�NJ,R\0��s�\r���V�\Z\0','2038-01-19 03:14:07'); |
| 776 | +INSERT INTO `mw_objectcache` VALUES ('test_wiki-mw_:resourceloader:filter:minify-js:22814eeadc9cf0a9ebcd844e14198e66','m��r�0��y����r�&Qޡמ!\n�qQ�Xq;}���$��ވ� �c!]]].o5S�\n�)Fq��L^��?�s�F�!�O�M\\�������\0���N��Ɂ���լ����:��-�j��F��{ۅ�G�\"i�� \Z�6�K����!��Y]=�F[�~竍���䶃����`��9N�Ǵ���@�K��|z�?1�A��@J#_ԁ�7\'�l�1)J�͵�).�3z�f�T�A���Hњ�[#)�BzRA�7��\"T�*~SW���/P���B�Ŏ;\Z�ay�6����+U��?.$�6��-uT�v@h��s�&�����Nإb�fJ�~�]6��p��/q)�>�E�1��͔A\ne�L�g\ZE�`cW�����`fJ�E�a��>��b\n�ӑd�.u�do��[�\nt��b�+���l\Z?X*��Y�(�օ;�L�Jqťɝ���d$�\"�WzG�-@b~+�#�kǞَ�Ƃ~������P)B ����q�Җ2���r�Rl����`z �4�����ÝX�m�;�X݁t;r.�sA��R��y)�kA�\nR�JT��J�U��*�W��_ߟ�4@�vt��f���>����x���','2038-01-19 03:14:07'); |
| 777 | +INSERT INTO `mw_objectcache` VALUES ('test_wiki-mw_:resourceloader:filter:minify-js:dd9440c19c575629ac5ec90e489cf62e','+�21�R���Ԕ�����L���Ĕ�\"��ĒT�j��̒T%+���ĔJ�ZMk.%k\0','2038-01-19 03:14:07'); |
778 | 778 | /*!40000 ALTER TABLE `mw_objectcache` ENABLE KEYS */; |
779 | 779 | UNLOCK TABLES; |
780 | 780 | |
— | — | @@ -1384,7 +1384,6 @@ |
1385 | 1385 | `user_newpassword` tinyblob NOT NULL, |
1386 | 1386 | `user_newpass_time` binary(14) DEFAULT NULL, |
1387 | 1387 | `user_email` tinytext NOT NULL, |
1388 | | - `user_options` blob NOT NULL, |
1389 | 1388 | `user_touched` binary(14) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0', |
1390 | 1389 | `user_token` binary(32) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', |
1391 | 1390 | `user_email_authenticated` binary(14) DEFAULT NULL, |
Index: trunk/phase3/includes/User.php |
— | — | @@ -1089,8 +1089,10 @@ |
1090 | 1090 | $this->mNewpassword = $row->user_newpassword; |
1091 | 1091 | $this->mNewpassTime = wfTimestampOrNull( TS_MW, $row->user_newpass_time ); |
1092 | 1092 | $this->mEmail = $row->user_email; |
1093 | | - $this->decodeOptions( $row->user_options ); |
1094 | | - $this->mTouched = wfTimestamp(TS_MW,$row->user_touched); |
| 1093 | + if ( isset( $row->user_options ) ) { |
| 1094 | + $this->decodeOptions( $row->user_options ); |
| 1095 | + } |
| 1096 | + $this->mTouched = wfTimestamp( TS_MW, $row->user_touched ); |
1095 | 1097 | $this->mToken = $row->user_token; |
1096 | 1098 | $this->mEmailAuthenticated = wfTimestampOrNull( TS_MW, $row->user_email_authenticated ); |
1097 | 1099 | $this->mEmailToken = $row->user_email_token; |
— | — | @@ -2693,8 +2695,10 @@ |
2694 | 2696 | /** |
2695 | 2697 | * Set this user's options from an encoded string |
2696 | 2698 | * @param $str String Encoded options to import |
| 2699 | + * |
| 2700 | + * @deprecated in 1.19 due to removal of user_options from the user table |
2697 | 2701 | */ |
2698 | | - public function decodeOptions( $str ) { |
| 2702 | + private function decodeOptions( $str ) { |
2699 | 2703 | if( !$str ) |
2700 | 2704 | return; |
2701 | 2705 | |
— | — | @@ -2822,7 +2826,6 @@ |
2823 | 2827 | 'user_real_name' => $this->mRealName, |
2824 | 2828 | 'user_email' => $this->mEmail, |
2825 | 2829 | 'user_email_authenticated' => $dbw->timestampOrNull( $this->mEmailAuthenticated ), |
2826 | | - 'user_options' => '', |
2827 | 2830 | 'user_touched' => $dbw->timestamp( $this->mTouched ), |
2828 | 2831 | 'user_token' => $this->mToken, |
2829 | 2832 | 'user_email_token' => $this->mEmailToken, |
— | — | @@ -2890,7 +2893,6 @@ |
2891 | 2894 | 'user_email' => $user->mEmail, |
2892 | 2895 | 'user_email_authenticated' => $dbw->timestampOrNull( $user->mEmailAuthenticated ), |
2893 | 2896 | 'user_real_name' => $user->mRealName, |
2894 | | - 'user_options' => '', |
2895 | 2897 | 'user_token' => $user->mToken, |
2896 | 2898 | 'user_registration' => $dbw->timestamp( $user->mRegistration ), |
2897 | 2899 | 'user_editcount' => 0, |
— | — | @@ -2924,7 +2926,6 @@ |
2925 | 2927 | 'user_email' => $this->mEmail, |
2926 | 2928 | 'user_email_authenticated' => $dbw->timestampOrNull( $this->mEmailAuthenticated ), |
2927 | 2929 | 'user_real_name' => $this->mRealName, |
2928 | | - 'user_options' => '', |
2929 | 2930 | 'user_token' => $this->mToken, |
2930 | 2931 | 'user_registration' => $dbw->timestamp( $this->mRegistration ), |
2931 | 2932 | 'user_editcount' => 0, |
Index: trunk/phase3/includes/installer/SqliteUpdater.php |
— | — | @@ -66,6 +66,8 @@ |
67 | 67 | array( 'addTable', 'globaltemplatelinks', 'patch-globaltemplatelinks.sql' ), |
68 | 68 | array( 'addTable', 'globalnamespaces', 'patch-globalnamespaces.sql' ), |
69 | 69 | array( 'addTable', 'globalinterwiki', 'patch-globalinterwiki.sql' ), |
| 70 | + array( 'doMigrateUserOptions' ), |
| 71 | + array( 'dropField', 'user', 'user_options', 'patch-drop-user_options.sql' ), |
70 | 72 | ); |
71 | 73 | } |
72 | 74 | |
Index: trunk/phase3/includes/installer/DatabaseUpdater.php |
— | — | @@ -566,4 +566,11 @@ |
567 | 567 | $task = $this->maintenance->runChild( 'UpdateCollation' ); |
568 | 568 | $task->execute(); |
569 | 569 | } |
| 570 | + |
| 571 | + protected function doMigrateUserOptions() { |
| 572 | + $cl = $this->maintenance->runChild( 'ConvertUserOptions' ); |
| 573 | + $this->output( "Migrating remaining user_options... " ); |
| 574 | + $cl->execute(); |
| 575 | + $this->output( "done.\n" ); |
| 576 | + } |
570 | 577 | } |
Index: trunk/phase3/includes/installer/MysqlUpdater.php |
— | — | @@ -188,6 +188,9 @@ |
189 | 189 | array( 'addTable', 'globaltemplatelinks', 'patch-globaltemplatelinks.sql' ), |
190 | 190 | array( 'addTable', 'globalnamespaces', 'patch-globalnamespaces.sql' ), |
191 | 191 | array( 'addTable', 'globalinterwiki', 'patch-globalinterwiki.sql' ), |
| 192 | + array( 'doMigrateUserOptions' ), |
| 193 | + array( 'dropField', 'user', 'user_options', 'patch-drop-user_options.sql' ), |
| 194 | + |
192 | 195 | ); |
193 | 196 | } |
194 | 197 | |