]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/ModLog/ModLog.php
More info for a proper, fancy-url lighttpd setup
[quix0rs-gnu-social.git] / plugins / ModLog / ModLog.php
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
31 if (!defined('STATUSNET')) {
32     exit(1);
33 }
34
35 /**
36  * Class comment here
37  *
38  * @category Category here
39  * @package  StatusNet
40  * @author   Evan Prodromou <evan@status.net>
41  * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
42  * @link     http://status.net/
43  *
44  * @see      DB_DataObject
45  */
46
47 class ModLog extends Managed_DataObject
48 {
49     public $__table = 'mod_log'; // table name
50
51     public $id;           // UUID
52     public $profile_id;   // profile id
53     public $moderator_id; // profile id
54     public $role;         // the role
55     public $grant;        // 1 = grant, 0 = revoke
56     public $created;      // datetime
57
58     /**
59      * The One True Thingy that must be defined and declared.
60      */
61     public static function schemaDef()
62     {
63         return array('description' => 'Log of moderation events',
64                      'fields' => array(
65                                        'id' => array('type' => 'varchar',
66                                                      'length' => 36,
67                                                      'not null' => true,
68                                                      'description' => 'unique event ID'),
69                                        'profile_id' => array('type' => 'int',
70                                                              'not null' => true,
71                                                              'description' => 'profile getting the role'),
72                                        'moderator_id' => array('type' => 'int',
73                                                                'description' => 'profile granting or revoking the role'),
74                                        'role' => array('type' => 'varchar',
75                                                        'length' => 32,
76                                                        'not null' => true,
77                                                        'description' => 'role granted or revoked'),
78                                        'is_grant' => array('type' => 'int',
79                                                            'size' => 'tiny',
80                                                            'default' => 1,
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('user_id' => 'id'))
90                                              ),
91                      'indexes' => array(
92                                         'mod_log_profile_id_created_idx' => array('profile_id', 'created'),
93                                         ),
94                      );
95     }
96 }