Menu="About:10"
Title="Update OS"
Icon="icon-update"
Tag="upload"
---
<?php
/* Copyright 2005-2023, Lime Technology
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License version 2,
 * as published by the Free Software Foundation.
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 */
require_once "$docroot/plugins/dynamix/include/ReplaceKey.php";
$replaceKey = new ReplaceKey();
$replaceKey->check();

require_once "$docroot/plugins/dynamix.my.servers/include/reboot-details.php";
$rebootDetails = new RebootDetails();
?>
<script>
function cleanUpFlashBackup(zip) {
  if (document.hasFocus()) {
    $('input[value="_(Creating Flash backup)_..."]').val("_(Flash backup)_").prop('disabled',false);
    $('div.spinner').hide('slow');
    $('#pleaseWait').hide('slow');
    $.post('/webGui/include/Download.php',{cmd:'unlink',file:zip});
  } else {
    setTimeout(function(){cleanUpFlashBackup(zip);},2000);
  }
}
function flashBackup() {
  $('input[value="_(Flash backup)_"]').val('_(Creating Flash backup)_...').prop('disabled',true);
  $('div.spinner').show('slow');
  $('#pleaseWait').show('slow');
  $.post('/webGui/include/Download.php',{cmd:'backup'},function(zip) {
    if (zip) {
      location = '/'+zip;
      setTimeout(function(){cleanUpFlashBackup(zip);},6000);
    } else {
      $('input[value="_(Creating Flash backup)_..."]').val("_(Flash backup)_");
      $('div.spinner').hide('slow');
      $('#pleaseWait').hide('slow');
      swal({title:"_(Creation error)_",text:"_(Insufficient free disk space available)_",type:'error',html:true,confirmButtonText:"_(Ok)_"});
    }
  });
}
</script>

<unraid-update-os reboot-version="<?= $rebootDetails->rebootVersion ?>"></unraid-update-os>
