core.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?php
  2. // This file is part of GNU social - https://www.gnu.org/software/social
  3. //
  4. // GNU social is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU Affero General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // GNU social is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU Affero General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Affero General Public License
  15. // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
  16. /**
  17. *
  18. * Some notes...
  19. *
  20. * decimal <-> numeric
  21. *
  22. * MySQL 'timestamp' columns were formerly used for 'modified' files for their
  23. * auto-updating properties. This didn't play well with changes to cache usage
  24. * in 0.9.x, as we don't know the timestamp value at INSERT time and never
  25. * have a chance to load it up again before caching. For now I'm leaving them
  26. * in, but we may want to clean them up later.
  27. *
  28. * Current code should be setting 'created' and 'modified' fields explicitly;
  29. * this also avoids mismatches between server and client timezone settings.
  30. *
  31. *
  32. * fulltext indexes?
  33. * got one or two things wanting a custom charset setting on a field?
  34. *
  35. * foreign keys are kinda funky...
  36. * those specified in inline syntax (as all in the original .sql) are NEVER ENFORCED on mysql
  37. * those made with an explicit 'foreign key' WITHIN INNODB and IF there's a proper index, do get enforced
  38. * double-check what we've been doing on postgres?
  39. */
  40. defined('GNUSOCIAL') || die();
  41. $classes = [
  42. 'Schema_version',
  43. 'Profile',
  44. 'Avatar',
  45. 'Sms_carrier',
  46. 'User',
  47. 'User_group',
  48. 'Subscription',
  49. 'Group_join_queue',
  50. 'Subscription_queue',
  51. 'Consumer',
  52. 'Oauth_application',
  53. 'Oauth_token_association',
  54. 'Conversation',
  55. 'Notice',
  56. 'Notice_location',
  57. 'Notice_source',
  58. 'Notice_prefs',
  59. 'Reply',
  60. 'Token',
  61. 'Nonce',
  62. 'Oauth_application_user',
  63. 'Confirm_address',
  64. 'Remember_me',
  65. 'Queue_item',
  66. 'Notice_tag',
  67. 'Foreign_service',
  68. 'Foreign_user',
  69. 'Foreign_link',
  70. 'Foreign_subscription',
  71. 'Invitation',
  72. 'Profile_prefs',
  73. 'Profile_list',
  74. 'Profile_tag',
  75. 'Profile_tag_subscription',
  76. 'Profile_block',
  77. 'Related_group',
  78. 'Group_inbox',
  79. 'Group_member',
  80. 'File',
  81. 'File_redirection',
  82. 'File_thumbnail',
  83. 'File_to_post',
  84. 'Group_block',
  85. 'Group_alias',
  86. 'Session',
  87. 'Config',
  88. 'Profile_role',
  89. 'Location_namespace',
  90. 'Login_token',
  91. 'User_location_prefs',
  92. 'User_im_prefs',
  93. 'Local_group',
  94. 'User_urlshortener_prefs',
  95. 'Old_school_prefs',
  96. 'User_username',
  97. 'Attention'
  98. ];
  99. foreach ($classes as $cls) {
  100. $schema[strtolower($cls)] = call_user_func([$cls, 'schemaDef']);
  101. }