Author Topic: maintenance Timer  (Read 83 times)

Offline CTGO.co LLC

  • Full Member
  • ***
  • Posts: 159
  • Karma: +2/-21
  • CTGO.co LLC
    • View Profile
    • CTGO.co LLC
maintenance Timer
« on: February 02, 2019, 04:36:59 AM »
hi!

I have suggestion about adding timer to the maintenance, I don't have idea hot to be this function in the main code but I added manual html code to a block in the maintenance. The code looks like this:

<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
p {
  text-align: center;
  font-size: 100px;
  margin-top: 100px;
}
</style>
</head>
<body>

<p id="demo"></p>

<script>
// Set the date we're counting down to
var countDownDate = new Date("Feb 1, 2019 15:30:00").getTime();

// Update the count down every 1 second
var x = setInterval(function() {

    // Get todays date and time
    var now = new Date().getTime();
   
    // Find the distance between now and the count down date
    var distance = countDownDate - now;
   
    // Time calculations for days, hours, minutes and seconds
    var days = Math.floor(distance / (1000 * 60 * 60 * 24));
    var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
    var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
    var seconds = Math.floor((distance % (1000 * 60)) / 1000);
   
    // Output the result in an element with id="demo"
    document.getElementById("demo").innerHTML = days + "d " + hours + "h "
    + minutes + "m " + seconds + "s ";
   
    // If the count down is over, write some text
    if (distance < 0) {
        clearInterval(x);
        document.getElementById("demo").innerHTML = "EXPIRED";
    }
}, 1000);
</script>

</body>
</html>




I think its gonna be good to add Automatic Timer to maintenance function which will stop maintenance automatically. 

Regards
CTGO.co LLC

Offline llegrand

  • Hero Member
  • *****
  • Posts: 1385
  • Karma: +354/-2
    • View Profile
Re: maintenance Timer
« Reply #1 on: February 02, 2019, 08:57:15 AM »
IMO  that is quite unnecessary and perhaps even a disaster in the making - When the admin  is finished with the process that required mtce mode that would be the correct time to take it off mtce.   What if your automatic time turned it back on in the middle of some updating that you weren't finished with?
Automation is useful for a lot of processes,  but some should be left to be manually executed when it is the correct time to do so. 

Again  this is my opinion.

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4128
  • Karma: +249/-9
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: maintenance Timer
« Reply #2 on: February 02, 2019, 09:14:39 PM »
Thank you for suggestion. I would have to agree with llegrand. Automation is great, but in this case, we can not be certain that user want to disable maintenance mode.
We can add a setting to enable or disable this automatic mode, but I am not sure how useful this will be.
We need your help to build better free open source eCommerce platform for everyone.
See how you can help

Offline CTGO.co LLC

  • Full Member
  • ***
  • Posts: 159
  • Karma: +2/-21
  • CTGO.co LLC
    • View Profile
    • CTGO.co LLC
Re: maintenance Timer
« Reply #3 on: February 04, 2019, 02:39:16 AM »
hi guys!


Thanks for you opinions and comments, however the function gonna be good at least when visitors would wanna do process of shopping on website and see that there is a maintenance period they can arrange the next visit to start the shopping time. otherwise, the admin of website at least he can guises the required time for his maintenance process too.


regards
CTGO.co LLC

Offline llegrand

  • Hero Member
  • *****
  • Posts: 1385
  • Karma: +354/-2
    • View Profile
Re: maintenance Timer
« Reply #4 on: February 04, 2019, 08:47:07 AM »
ah and now there is clarity of what you want to do-  you're not asking for the mtce to be automatically turned back on -  but for the mtce display page to give site visitors a time when the site will be back.


You're request for a return time  makes more sense now.