ModLog.php 4.2 KB

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