]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - classes/Session.php
[OStatus] Wrong exception was being caught
[quix0rs-gnu-social.git] / classes / Session.php
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  * Table Definition for session
19  *
20  * @package   GNUsocial
21  * @author    Evan Prodromou
22  * @author    Brion Vibber
23  * @author    Mikael Nordfeldth
24  * @author    Sorokin Alexei
25  * @author    Diogo Cordeiro <diogo@fc.up.pt>
26  * @copyright 2019 Free Software Foundation, Inc http://www.fsf.org
27  * @license   https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
28  */
29
30 defined('GNUSOCIAL') || die();
31
32 require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
33
34 /**
35  * Superclass representing a saved session as it exists in the database.
36  *
37  * @copyright 2019 Free Software Foundation, Inc http://www.fsf.org
38  * @license   https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
39  */
40 class Session extends Managed_DataObject
41 {
42     ###START_AUTOCODE
43     /* the code below is auto generated do not remove the above tag */
44
45     public $__table = 'session';             // table name
46     public $id;                              // varchar(32)  primary_key not_null
47     public $session_data;                    // text()
48     public $created;                         // datetime()   not_null
49     public $modified;                        // timestamp()  not_null default_CURRENT_TIMESTAMP
50
51     /* the code above is auto generated do not remove the tag below */
52     ###END_AUTOCODE
53
54     /**
55      * Returns an array describing how the session is stored in the database.
56      *
57      * @return array
58      */
59     public static function schemaDef()
60     {
61         return [
62             'fields' => [
63                 'id' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'session ID'],
64                 'session_data' => ['type' => 'text', 'description' => 'session data'],
65                 'created' => ['type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'],
66                 'modified' => ['type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'],
67             ],
68             'primary key' => ['id'],
69             'indexes' => [
70                 'session_modified_idx' => ['modified'],
71             ],
72         ];
73     }
74
75     /**
76      * New code should NOT call this function.
77      * Dummy function for backwards compatibility with older plugins like Qvitter.
78      * Stuff to do before the request teardown.
79      *
80      * @return void
81      */
82     public static function cleanup()
83     {
84         session_write_close();
85     }
86 }