From 0c80ef88b5ba5220adc6f3ff22cce6824030a75b Mon Sep 17 00:00:00 2001 From: Zack Spear Date: Tue, 21 Nov 2023 10:42:30 -0800 Subject: [PATCH] refactor(plg): state read case model from flash --- .../dynamix.my.servers/include/state.php | 30 ++----------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include/state.php b/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include/state.php index 7ee14f933..03b020a81 100644 --- a/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include/state.php +++ b/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include/state.php @@ -49,7 +49,7 @@ class ServerState private $osVersionBranch; private $registered; private $rebootDetails; - private $caseModel; + private $caseModel = ''; /** * Constructor to initialize class properties and gather server information. @@ -97,10 +97,8 @@ class ServerState $this->osVersionBranch = trim(@exec('plugin category /var/log/plugins/unRAIDServer.plg') ?? 'stable'); $this->registered = !empty($this->myservers['remote']['apikey']) && $this->connectPluginInstalled; - // if we're on 6.12.6 or newer, get the case model as this version will include the cookie with the case model when it's reset - if (version_compare('6.12.6', $this->osVersion, '>=')) { - $this->caseModel = $this->getServerCase(); - } + $caseModelFile = '/boot/config/plugins/dynamix/case-model.cfg'; + $this->caseModel = file_exists($caseModelFile) ? file_get_contents($caseModelFile) : ''; $this->rebootDetails = new RebootDetails(); } @@ -112,28 +110,6 @@ class ServerState return $this->webguiGlobals[$key]; } - public function getServerCase() { - $caseModel = $_COOKIE['caseModel'] ?? ''; - // if we don't have a cookie, check the file and set the cookie if we find one - if (!$caseModel) { - $caseModelFile = '/boot/config/plugins/dynamix/case-model.cfg'; - $caseModel = file_exists($caseModelFile) ? file_get_contents($caseModelFile) : ''; - // if ($caseModel) { - // $cookieOptions = array ( - // 'expires' => time() + (10 * 365 * 24 * 60 * 60), // overkill with 10 years - // 'path' => '/', - // 'secure' => false, - // 'httponly' => false, - // 'samesite' => 'Strict', - // ); - // setcookie('caseModel', $caseModel, $cookieOptions); - // } else { - // $caseModel = 'unknown'; - // } - } - return $caseModel; - } - /** * Retrieve the server information as an associative array *