[SESSION] Add backwards compatibility for third party plugins depending on old Session::cleanup()

Namely Qvitter
This commit is contained in:
Diogo Cordeiro 2019-06-07 22:04:02 +01:00
parent 2110c20ecc
commit 08b6cfde66
2 changed files with 66 additions and 40 deletions

View File

@ -1,36 +1,41 @@
<?php <?php
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
/** /**
* Table Definition for session * Table Definition for session
* *
* StatusNet - the distributed open-source microblogging tool * @package GNUsocial
* Copyright (C) 2009, StatusNet, Inc. * @author Evan Prodromou
* * @author Brion Vibber
* This program is free software: you can redistribute it and/or modify * @author Mikael Nordfeldth
* it under the terms of the GNU Affero General Public License as published by * @author Sorokin Alexei
* the Free Software Foundation, either version 3 of the License, or * @author Diogo Cordeiro <diogo@fc.up.pt>
* (at your option) any later version. * @copyright 2019 Free Software Foundation, Inc http://www.fsf.org
* * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
if (!defined('STATUSNET') && !defined('LACONICA')) { defined('GNUSOCIAL') || die();
exit(1);
}
require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
/** /**
* Table definition for Session
*
* Superclass representing a saved session as it exists in the database. * Superclass representing a saved session as it exists in the database.
* *
* @author GNU social * @copyright 2019 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
class Session extends Managed_DataObject class Session extends Managed_DataObject
{ {
@ -48,6 +53,8 @@ class Session extends Managed_DataObject
/** /**
* Returns an array describing how the session is stored in the database. * Returns an array describing how the session is stored in the database.
*
* @return array
*/ */
public static function schemaDef() public static function schemaDef()
{ {
@ -64,4 +71,16 @@ class Session extends Managed_DataObject
], ],
]; ];
} }
/**
* New code should NOT call this function.
* Dummy function for backwards compatibility with older plugins like Qvitter.
* Stuff to do before the request teardown.
*
* @return void
*/
public static function cleanup()
{
session_write_close();
}
} }

View File

@ -1,32 +1,39 @@
<?php <?php
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
/** /**
* GNU social's implementation of SessionHandler * GNU social's implementation of SessionHandler
* *
* StatusNet - the distributed open-source microblogging tool * @package GNUsocial
* Copyright (C) 2009, StatusNet, Inc. * @author Evan Prodromou
* * @author Brion Vibber
* This program is free software: you can redistribute it and/or modify * @author Mikael Nordfeldth
* it under the terms of the GNU Affero General Public License as published by * @author Sorokin Alexei
* the Free Software Foundation, either version 3 of the License, or * @author Diogo Cordeiro <diogo@fc.up.pt>
* (at your option) any later version. * @copyright 2019 Free Software Foundation, Inc http://www.fsf.org
* * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
if (!defined('GNUSOCIAL')) { defined('GNUSOCIAL') || die();
exit(1);
}
/** /**
* Superclass representing the associated interfaces of session handling. * Superclass representing the associated interfaces of session handling.
* *
* @author GNU social * @copyright 2019 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
class InternalSessionHandler implements SessionHandlerInterface class InternalSessionHandler implements SessionHandlerInterface
{ {