ModLog.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. * StatusNet - the distributed open-source microblogging tool
  18. * Copyright (C) 2012, StatusNet, Inc.
  19. *
  20. * ModLog.php -- data object to store moderation logs
  21. *
  22. * PHP version 5
  23. *
  24. * This program is free software: you can redistribute it and/or modify
  25. * it under the terms of the GNU Affero General Public License as published by
  26. * the Free Software Foundation, either version 3 of the License, or
  27. * (at your option) any later version.
  28. *
  29. * This program is distributed in the hope that it will be useful,
  30. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  31. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  32. * GNU Affero General Public License for more details.
  33. *
  34. * You should have received a copy of the GNU Affero General Public License
  35. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  36. *
  37. * @category Moderation
  38. * @package GNUsocial
  39. * @author Evan Prodromou <evan@status.net>
  40. * @copyright 2012 StatusNet, Inc.
  41. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
  42. */
  43. defined('GNUSOCIAL') || die();
  44. /**
  45. * @copyright 2012 StatusNet, Inc.
  46. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
  47. *
  48. * @see DB_DataObject
  49. */
  50. class ModLog extends Managed_DataObject
  51. {
  52. public $__table = 'mod_log'; // table name
  53. public $id; // UUID
  54. public $profile_id; // profile id
  55. public $moderator_id; // profile id
  56. public $role; // the role
  57. public $is_grant; // true = grant, false = revoke
  58. public $created; // datetime
  59. /**
  60. * The One True Thingy that must be defined and declared.
  61. */
  62. public static function schemaDef()
  63. {
  64. return array('description' => 'Log of moderation events',
  65. 'fields' => array(
  66. 'id' => array('type' => 'varchar',
  67. 'length' => 36,
  68. 'not null' => true,
  69. 'description' => 'unique event ID'),
  70. 'profile_id' => array('type' => 'int',
  71. 'not null' => true,
  72. 'description' => 'profile getting the role'),
  73. 'moderator_id' => array('type' => 'int',
  74. 'description' => 'profile granting or revoking the role'),
  75. 'role' => array('type' => 'varchar',
  76. 'length' => 32,
  77. 'not null' => true,
  78. 'description' => 'role granted or revoked'),
  79. 'is_grant' => array('type' => 'bool',
  80. 'default' => true,
  81. 'description' => 'Was this a grant or revocation of a role'),
  82. 'created' => array('type' => 'datetime',
  83. 'not null' => true,
  84. 'description' => 'date this record was created')
  85. ),
  86. 'primary key' => array('id'),
  87. 'foreign keys' => array(
  88. 'mod_log_profile_id_fkey' => array('profile', array('profile_id' => 'id')),
  89. 'mod_log_moderator_id_fkey' => array('user', array('moderator_id' => 'id'))
  90. ),
  91. 'indexes' => array(
  92. 'mod_log_profile_id_created_idx' => array('profile_id', 'created'),
  93. ),
  94. );
  95. }
  96. }