Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
3.3 KiB

11 years ago
11 years ago
11 years ago
11 years ago
  1. <?php
  2. function update_1000() {
  3. q("ALTER TABLE `item` DROP `like`, DROP `dislike` ");
  4. q("ALTER TABLE `item` ADD `verb` CHAR( 255 ) NOT NULL AFTER `body` ,
  5. ADD `object-type` CHAR( 255 ) NOT NULL AFTER `verb` ,
  6. ADD `object` TEXT NOT NULL AFTER `object-type` ");
  7. q("ALTER TABLE `intro` ADD `duplex` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `knowyou` ");
  8. q("ALTER TABLE `contact` ADD `duplex` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `rel` ");
  9. q("ALTER TABLE `contact` CHANGE `issued-pubkey` `issued-pubkey` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL");
  10. q("ALTER TABLE `contact` ADD `term-date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `avatar-date`");
  11. }
  12. function update_1001() {
  13. q("ALTER TABLE `item` ADD `wall` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `type` ");
  14. q("ALTER TABLE `item` ADD INDEX ( `wall` )");
  15. }
  16. function update_1002() {
  17. q("ALTER TABLE `item` ADD `gravity` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `wall` ");
  18. }
  19. function update_1003() {
  20. q("ALTER TABLE `contact` DROP `issued-pubkey` , DROP `ret-id` , DROP `ret-pubkey` ");
  21. q("ALTER TABLE `contact` ADD `usehub` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `ret-aes`");
  22. q("ALTER TABLE `contact` ADD `hub-verify` CHAR( 255 ) NOT NULL AFTER `usehub`");
  23. q("ALTER TABLE `contact` ADD INDEX ( `uid` ) , ADD INDEX ( `self` ), ADD INDEX ( `issued-id` ), ADD INDEX ( `dfrn-id` )");
  24. q("ALTER TABLE `contact` ADD INDEX ( `blocked` ), ADD INDEX ( `readonly` )");
  25. }
  26. function update_1004() {
  27. q("ALTER TABLE `contact` ADD `subhub` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `usehub`");
  28. }
  29. function update_1005() {
  30. q("ALTER TABLE `user` ADD `spubkey` TEXT NOT NULL AFTER `prvkey` ,
  31. ADD `sprvkey` TEXT NOT NULL AFTER `spubkey`");
  32. }
  33. function update_1006() {
  34. // create 's' keys for everybody that does not have one
  35. $r = q("SELECT * FROM `user` WHERE `spubkey` = '' ");
  36. if(count($r)) {
  37. foreach($r as $rr) {
  38. $sres=openssl_pkey_new(array('encrypt_key' => false ));
  39. $sprvkey = '';
  40. openssl_pkey_export($sres, $sprvkey);
  41. $spkey = openssl_pkey_get_details($sres);
  42. $spubkey = $spkey["key"];
  43. $r = q("UPDATE `user` SET `spubkey` = '%s', `sprvkey` = '%s'
  44. WHERE `uid` = %d LIMIT 1",
  45. dbesc($spubkey),
  46. dbesc($sprvkey),
  47. intval($rr['uid'])
  48. );
  49. }
  50. }
  51. }
  52. function update_1007() {
  53. q("ALTER TABLE `user` ADD `page-flags` INT NOT NULL DEFAULT '0' AFTER `notify-flags`");
  54. q("ALTER TABLE `user` ADD INDEX ( `nickname` )");
  55. }
  56. function update_1008() {
  57. q("ALTER TABLE `profile` ADD `with` TEXT NOT NULL AFTER `marital` ");
  58. }
  59. function update_1009() {
  60. q("ALTER TABLE `user` ADD `allow_location` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `default-location` ");
  61. }
  62. function update_1010() {
  63. q("ALTER TABLE `contact` ADD `lrdd` CHAR( 255 ) NOT NULL AFTER `url` ");
  64. }
  65. function update_1011() {
  66. q("ALTER TABLE `contact` ADD `nick` CHAR( 255 ) NOT NULL AFTER `name` ");
  67. $r = q("SELECT * FROM `contact` WHERE 1");
  68. if(count($r)) {
  69. foreach($r as $rr) {
  70. q("UPDATE `contact` SET `nick` = '%s' WHERE `id` = %d LIMIT 1",
  71. dbesc(basename($rr['url'])),
  72. intval($rr['id'])
  73. );
  74. }
  75. }
  76. }
  77. function update_1012() {
  78. q("ALTER TABLE `item` ADD `inform` MEDIUMTEXT NOT NULL AFTER `tag` ");
  79. }
  80. function update_1013() {
  81. q("ALTER TABLE `item` ADD `target-type` CHAR( 255 ) NOT NULL
  82. AFTER `object` , ADD `target` TEXT NOT NULL AFTER `target-type`");
  83. }