2 // This file is part of GNU social - https://www.gnu.org/software/social
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.
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.
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/>.
18 * Table Definition for session
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
30 defined('GNUSOCIAL') || die();
32 require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
35 * Superclass representing a saved session as it exists in the database.
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
40 class Session extends Managed_DataObject
43 /* the code below is auto generated do not remove the above tag */
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
51 /* the code above is auto generated do not remove the tag below */
55 * Returns an array describing how the session is stored in the database.
59 public static function schemaDef()
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'],
68 'primary key' => ['id'],
70 'session_modified_idx' => ['modified'],
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.
82 public static function cleanup()
84 session_write_close();