mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-01 19:06:16 +01:00
Cleanly handle session corruption due to changing Flex object types
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
1. [](#improved)
|
||||
* Better logic for delete action to support Ajax. Fixes Flex lists
|
||||
* Added an `unauthorized.html.twig` file [#1609](https://github.com/getgrav/grav-plugin-admin/pull/1609)
|
||||
* Cleanly handle session corruption due to changing Flex object types
|
||||
1. [](#bugfix)
|
||||
* Fallback to page `slug` in Pages list if title is empty [grav#2267](https://github.com/getgrav/grav/issues/2267)
|
||||
* Fixes backup button issues with `;` param separator [#1602](https://github.com/getgrav/grav-plugin-admin/issues/1602) [#1502](https://github.com/getgrav/grav-plugin-admin/issues/1502)
|
||||
|
||||
15
admin.php
15
admin.php
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace Grav\Plugin;
|
||||
|
||||
use Grav\Common\Debugger;
|
||||
use Grav\Common\File\CompiledYamlFile;
|
||||
use Grav\Common\Grav;
|
||||
use Grav\Common\Helpers\LogViewer;
|
||||
@@ -13,6 +14,7 @@ use Grav\Common\Session;
|
||||
use Grav\Common\Uri;
|
||||
use Grav\Common\Utils;
|
||||
use Grav\Common\User\User;
|
||||
use Grav\Framework\Session\Exceptions\SessionException;
|
||||
use Grav\Plugin\Admin\Admin;
|
||||
use Grav\Plugin\Admin\Popularity;
|
||||
use Grav\Plugin\Admin\Themes;
|
||||
@@ -163,7 +165,18 @@ class AdminPlugin extends Plugin
|
||||
|
||||
// Only activate admin if we're inside the admin path.
|
||||
if ($this->isAdminPath()) {
|
||||
$this->grav['session']->init();
|
||||
try {
|
||||
$this->grav['session']->init();
|
||||
} catch (SessionException $e) {
|
||||
$this->grav['session']->init();
|
||||
$message = 'Session corruption detected, restarting session...';
|
||||
|
||||
/** @var Debugger $debugger */
|
||||
$debugger = $this->grav['debugger'];
|
||||
$debugger->addMessage($message);
|
||||
|
||||
$this->grav['messages']->add($message, 'error');
|
||||
}
|
||||
$this->active = true;
|
||||
|
||||
// Set cache based on admin_cache option
|
||||
|
||||
Reference in New Issue
Block a user