Skip to content

Commit

Permalink
Update migrate page to stream results correctly under php-fpm, make a…
Browse files Browse the repository at this point in the history
… nice loader and style
  • Loading branch information
Nicolás committed Oct 5, 2023
1 parent b916597 commit f0797dc
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 13 deletions.
19 changes: 12 additions & 7 deletions modules/backup_restore/restore.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
+----------------------------------------------------------------------+
| The Initial Developer is Issabel Foundation |
+----------------------------------------------------------------------+
*/
*/

$module_name=basename(getcwd());
$documentRoot = $_SERVER["DOCUMENT_ROOT"];
include_once "$documentRoot/libs/paloSantoDB.class.php";
Expand All @@ -37,14 +38,15 @@

$backup_dir = $arrConfModule['dir'];

echo "<html><head></head><body>";

if (isset($_REQUEST['filename'])){
$filename = escapeshellarg($_REQUEST['filename']);
$filename = substr($filename,1,-1);
$filename = $backup_dir."/".$filename;
if(is_file($filename)) {
echo "<div style='font-family: \"Lucida Console\", Monaco, monospace'>";
$padSize = ini_get('output_buffering');
$dahdi = "";
$cmd = "/usr/bin/issabel-helper migration $dahdi $filename";
$cmd .= " 2>&1 || echo \"err_flag\"";
Expand All @@ -57,15 +59,18 @@
$error = true;
break;
}
echo $line."<br>";
echo str_pad("$line<br>", $padSize);
ob_flush();
flush();
@ flush();
}
pclose($file);
pclose($file);

echo "</div>";
echo "<script>alert('Migration Complete');</script>";
echo "<script>window.parent.document.getElementById('loader').style.display='none';window.parent.document.getElementById('check').style.display='block';parent.clearInterval(parent.pepe);</script>";


} else {
echo "$filename is not a file";
}
}

echo "</body></html>";
2 changes: 2 additions & 0 deletions modules/backup_restore/themes/default/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,5 @@ altura 0 (Elastix bug #1526) */
.droptrue, .droptrue2 {
min-height: 20px;
}

*{padding:0;margin:0}.checkwrapper{display:flex;justify-content:center;align-items:center;background-color:#fff;zoom:.6;display:none;}.checkmark__circle{stroke-dasharray: 166;stroke-dashoffset: 166;stroke-width: 2;stroke-miterlimit: 10;stroke: #7ac142;fill: none;animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards}.checkmark{width: 56px;height: 56px;border-radius: 50%;display: block;stroke-width: 2;stroke: #fff;stroke-miterlimit: 10;margin: 10% auto;box-shadow: inset 0px 0px 0px #7ac142;animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s both}.checkmark__check{transform-origin: 50% 50%;stroke-dasharray: 48;stroke-dashoffset: 48;animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards}@keyframes stroke{100%{stroke-dashoffset: 0}}@keyframes scale{0%, 100%{transform: none}50%{transform: scale3d(1.1, 1.1, 1)}}@keyframes fill{100%{box-shadow: inset 0px 0px 0px 30px #7ac142}}
19 changes: 13 additions & 6 deletions modules/backup_restore/themes/default/migration.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
<table class="tabForm" style="font-size: 16px;" cellspacing="0" cellpadding="0" width="100%">
<tr><td align="left" colspan="2"><b>{php}echo _tr('Progress');{/php}</b></td></tr>
<tr><td align="left" colspan="2"><div class='hr-line'></div></td></tr>
</table>
<div style='font-family: "Lucida Console", Monaco, monospace;'>
<iframe name="ifm" id="ifm" frameborder=0 width="100%" height="500px" marginheight=0 marginwidth=0 scrolling=yes src={$frame_url}></iframe>
<div class='box'>
<div style='display:flex; align-items:center; gap:1em;'>
<div><h2>{php}echo _tr('Progress');{/php}</h2></div>
<div id='loader'><i class="fa fa-spinner fa-spin" style='font-size:2.5em; color: orange;'></i></div>
<div class="checkwrapper" id="check"><svg class="checkmark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52"> <circle class="checkmark__circle" cx="26" cy="26" r="25" fill="none"/> <path class="checkmark__check" fill="none" d="M14.1 27.2l7.1 7.2 16.7-16.8"/></svg></div>
</div>
<div style='padding-top:2em;'>
<iframe name="ifm" id="myframe" frameborder=0 width="100%" height="500px" marginheight=0 marginwidth=0 scrolling=yes src={$frame_url}></iframe>
</div>
</div>
</div>
<script>
pepe = setInterval('frames[0].scrollTo(0,9999999)',1000);
</script>

0 comments on commit f0797dc

Please sign in to comment.