ModLog.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. * Data object to store moderation logs
  18. *
  19. * @category Moderation
  20. * @package GNUsocial
  21. * @author Evan Prodromou <evan@status.net>
  22. * @copyright 2012 StatusNet, Inc.
  23. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
  24. */
  25. defined('GNUSOCIAL') || die();
  26. /**
  27. * @copyright 2012 StatusNet, Inc.
  28. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
  29. *
  30. * @see DB_DataObject
  31. */
  32. class ModLog extends Managed_DataObject
  33. {
  34. public $__table = 'mod_log'; // table name
  35. public $id; // UUID
  36. public $profile_id; // profile id
  37. public $moderator_id; // profile id
  38. public $role; // the role
  39. public $is_grant; // true = grant, false = revoke
  40. public $created; // datetime
  41. /**
  42. * The One True Thingy that must be defined and declared.
  43. */
  44. public static function schemaDef()
  45. {
  46. return array('description' => 'Log of moderation events',
  47. 'fields' => array(
  48. 'id' => array('type' => 'varchar',
  49. 'length' => 36,
  50. 'not null' => true,
  51. 'description' => 'unique event ID'),
  52. 'profile_id' => array('type' => 'int',
  53. 'not null' => true,
  54. 'description' => 'profile getting the role'),
  55. 'moderator_id' => array('type' => 'int',
  56. 'description' => 'profile granting or revoking the role'),
  57. 'role' => array('type' => 'varchar',
  58. 'length' => 32,
  59. 'not null' => true,
  60. 'description' => 'role granted or revoked'),
  61. 'is_grant' => array('type' => 'bool',
  62. 'default' => true,
  63. 'description' => 'Was this a grant or revocation of a role'),
  64. 'created' => array('type' => 'datetime',
  65. 'not null' => true,
  66. 'description' => 'date this record was created')
  67. ),
  68. 'primary key' => array('id'),
  69. 'foreign keys' => array(
  70. 'mod_log_profile_id_fkey' => array('profile', array('profile_id' => 'id')),
  71. 'mod_log_moderator_id_fkey' => array('user', array('moderator_id' => 'id'))
  72. ),
  73. 'indexes' => array(
  74. 'mod_log_profile_id_created_idx' => array('profile_id', 'created'),
  75. ),
  76. );
  77. }
  78. }