mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-03 11:55:52 +01:00
Cleanly handle session corruption due to changing Flex object types
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
1. [](#improved)
|
1. [](#improved)
|
||||||
* Better logic for delete action to support Ajax. Fixes Flex lists
|
* 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)
|
* 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)
|
1. [](#bugfix)
|
||||||
* Fallback to page `slug` in Pages list if title is empty [grav#2267](https://github.com/getgrav/grav/issues/2267)
|
* 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)
|
* 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
|
<?php
|
||||||
namespace Grav\Plugin;
|
namespace Grav\Plugin;
|
||||||
|
|
||||||
|
use Grav\Common\Debugger;
|
||||||
use Grav\Common\File\CompiledYamlFile;
|
use Grav\Common\File\CompiledYamlFile;
|
||||||
use Grav\Common\Grav;
|
use Grav\Common\Grav;
|
||||||
use Grav\Common\Helpers\LogViewer;
|
use Grav\Common\Helpers\LogViewer;
|
||||||
@@ -13,6 +14,7 @@ use Grav\Common\Session;
|
|||||||
use Grav\Common\Uri;
|
use Grav\Common\Uri;
|
||||||
use Grav\Common\Utils;
|
use Grav\Common\Utils;
|
||||||
use Grav\Common\User\User;
|
use Grav\Common\User\User;
|
||||||
|
use Grav\Framework\Session\Exceptions\SessionException;
|
||||||
use Grav\Plugin\Admin\Admin;
|
use Grav\Plugin\Admin\Admin;
|
||||||
use Grav\Plugin\Admin\Popularity;
|
use Grav\Plugin\Admin\Popularity;
|
||||||
use Grav\Plugin\Admin\Themes;
|
use Grav\Plugin\Admin\Themes;
|
||||||
@@ -163,7 +165,18 @@ class AdminPlugin extends Plugin
|
|||||||
|
|
||||||
// Only activate admin if we're inside the admin path.
|
// Only activate admin if we're inside the admin path.
|
||||||
if ($this->isAdminPath()) {
|
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;
|
$this->active = true;
|
||||||
|
|
||||||
// Set cache based on admin_cache option
|
// Set cache based on admin_cache option
|
||||||
|
|||||||
Reference in New Issue
Block a user