diff --git a/src/Core/Session/CacheSession.php b/src/Core/Session/Cache.php similarity index 96% rename from src/Core/Session/CacheSession.php rename to src/Core/Session/Cache.php index fdf9aa6d4e..f5dee0fab8 100644 --- a/src/Core/Session/CacheSession.php +++ b/src/Core/Session/Cache.php @@ -14,7 +14,7 @@ use SessionHandlerInterface; * * @author Hypolite Petovan */ -final class CacheSession extends NativeSession implements SessionHandlerInterface +final class Cache extends Native implements SessionHandlerInterface { /** @var ICache */ private $cache; diff --git a/src/Core/Session/DatabaseSession.php b/src/Core/Session/Database.php similarity index 97% rename from src/Core/Session/DatabaseSession.php rename to src/Core/Session/Database.php index c431be9aaa..5874c5d4f5 100644 --- a/src/Core/Session/DatabaseSession.php +++ b/src/Core/Session/Database.php @@ -14,7 +14,7 @@ use SessionHandlerInterface; * * @author Hypolite Petovan */ -final class DatabaseSession extends NativeSession implements SessionHandlerInterface +final class Database extends Native implements SessionHandlerInterface { /** @var Database */ private $dba; diff --git a/src/Core/Session/MemorySession.php b/src/Core/Session/Memory.php similarity index 87% rename from src/Core/Session/MemorySession.php rename to src/Core/Session/Memory.php index eee481d3b0..a7e336627f 100644 --- a/src/Core/Session/MemorySession.php +++ b/src/Core/Session/Memory.php @@ -5,12 +5,15 @@ namespace Friendica\Core\Session; /** * Usable for backend processes (daemon/worker) and testing */ -final class MemorySession implements ISession +final class Memory implements ISession { private $data = []; public function start() { + // Backward compatibility until all Session variables are replaced + // with the Session class + $_SESSION = []; $this->clear(); return $this; } diff --git a/src/Core/Session/NativeSession.php b/src/Core/Session/Native.php similarity index 97% rename from src/Core/Session/NativeSession.php rename to src/Core/Session/Native.php index 49278ed4a6..b7f992b274 100644 --- a/src/Core/Session/NativeSession.php +++ b/src/Core/Session/Native.php @@ -9,7 +9,7 @@ use Friendica\Model\User\Cookie; /** * The native Session class which uses the PHP internal Session function */ -class NativeSession implements ISession +class Native implements ISession { /** @var Cookie */ protected $cookie; diff --git a/src/Factory/SessionFactory.php b/src/Factory/SessionFactory.php index 999c424c99..47baa74708 100644 --- a/src/Factory/SessionFactory.php +++ b/src/Factory/SessionFactory.php @@ -6,12 +6,12 @@ use Friendica\App; use Friendica\Core\Cache\Cache; use Friendica\Core\Cache\ICache; use Friendica\Core\Config\Configuration; -use Friendica\Core\Session\CacheSession; -use Friendica\Core\Session\DatabaseSession; +use Friendica\Core\Session\Cache; +use Friendica\Core\Session\Database; use Friendica\Core\Session\ISession; use Friendica\Core\Session\Memory; -use Friendica\Core\Session\MemorySession; -use Friendica\Core\Session\NativeSession; +use Friendica\Core\Session\Memory; +use Friendica\Core\Session\Native; use Friendica\Core\System; use Friendica\Database\Database; use Friendica\Model\User\Cookie; @@ -52,24 +52,24 @@ class SessionFactory try { if ($mode->isInstall() || $mode->isBackend()) { - $session = new MemorySession(); + $session = new Memory(); } else { $session_handler = $config->get('system', 'session_handler', self::DEFAULT); switch ($session_handler) { case self::INTERNAL: - $session = new NativeSession($config, $cookie); + $session = new Native($config, $cookie); break; case self::DATABASE: default: - $session = new DatabaseSession($config, $cookie, $dba, $logger, $server); + $session = new Database($config, $cookie, $dba, $logger, $server); break; case self::CACHE: // In case we're using the db as cache driver, use the native db session, not the cache if ($config->get('system', 'cache_driver') === Cache::TYPE_DATABASE) { - $session = new DatabaseSession($config, $cookie, $dba, $logger, $server); + $session = new Database($config, $cookie, $dba, $logger, $server); } else { - $session = new CacheSession($config, $cookie, $cache, $logger, $server); + $session = new Cache($config, $cookie, $cache, $logger, $server); } break; }