mirror of
https://github.com/unraid/api.git
synced 2026-01-08 17:49:59 -06:00
refactor: reboot detection passed to upc
This commit is contained in:
@@ -2,6 +2,17 @@
|
||||
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once("$docroot/plugins/dynamix.my.servers/include/state.php");
|
||||
require_once("$docroot/plugins/dynamix.my.servers/include/translations.php");
|
||||
|
||||
/**
|
||||
* Reboot detection was moved from Update.page to here as to seed the web components on every page rather than just on /Tools/Update
|
||||
*/
|
||||
$readme = @file_get_contents("$docroot/plugins/unRAIDServer/README.md",false,null,0,20)?:''; // read first 20 bytes of README.md
|
||||
$reboot = preg_match("/^\*\*(REBOOT REQUIRED|DOWNGRADE)/", $readme);
|
||||
|
||||
$rebootForDowngrade = $reboot && strpos($readme, 'DOWNGRADE') !== false;
|
||||
$rebootForUpgrade = $reboot && strpos($readme, 'REBOOT REQUIRED') !== false;
|
||||
|
||||
$rebootType = $rebootForDowngrade ? 'downgrade' : ($rebootForUpgrade ? 'upgrade' : '');
|
||||
?>
|
||||
<script>
|
||||
window.LOCALE_DATA = '<?= rawurlencode(json_encode($webComponentTranslations, JSON_UNESCAPED_SLASHES, JSON_UNESCAPED_UNICODE)) ?>';
|
||||
@@ -21,5 +32,7 @@ if (!document.getElementsByTagName(modalsWebComponent).length) {
|
||||
<?
|
||||
echo "
|
||||
<unraid-i18n-host>
|
||||
<unraid-user-profile server='" . json_encode($serverState) . "'></unraid-user-profile>
|
||||
<unraid-user-profile
|
||||
reboot-type='" . $rebootType . "'
|
||||
server='" . json_encode($serverState) . "'></unraid-user-profile>
|
||||
</unraid-i18n-host>";
|
||||
|
||||
Reference in New Issue
Block a user