Maintenance.php first time display off line

Hi

I’m trying to understand this code and how its updated so next time maintenance.php is run its NOT the first time the display is off line. So an offline email is not generated. At the moment I get an email each time maintenance.php is run.

// Is this the first time this display has gone “off-line”
$displayGoneOffline = (Kit::ValidateParam($display[‘loggedin’], _INT) == 1

Thanks
Michael

So there’s a flag in the database “loggedin” for each display. If it was set to 1, and now the display is offline then an email will be generated and the flag set to 0. Then on future runs it will not be sent as the flag is now 0 already.

You can however opt to have emails sent every time the maintenance script is run - so check your value for MAINTENANCE_ALWAYS_ALERT as if that’s set to True then you will get a message every time.

Thanks Alex - can you please point me to where in maintenance .php the flag is set to zero e.g. the line of code ? I can’t see it !!! And I’m trying work out why I get an offline email every time run maintenance.php - which suggests in my case its not being zeroed. I’m looking at 1.7.4 code.

It’s set here:
https://github.com/xibosignage/xibo-cms/blob/master/lib/data/display.data.class.php#L787

The call to ValidateDisplay is made for each display considered in the loop.

Thanks for your patience answering my dumb questions.

If I understand correctly the Logged In flag is set on or off by the CMS and controlled by the timeout ??

And maintenance.php just reads the current status of the flag. So if maintenance.php runs say every 5 minutes and the timeout is 30 minutes then I could get several emails telling the display is off line ??

But if I ran maintenance.php say every 30 minutes I may never get a email ?? Because maintenance.php runs asynchronously to the CMS ??

Whats the best way to do this. Should maintenance.php be updating a database flag to it knows the display has already been reported as going off line.

Or maybe I’ve got this totally wrong ??

Thanks
Michael

You get one email the first time maintenance runs after the timeout expires. If you’re getting more than one then you have the Always Alert setting turned on

Thanks Alex - that worked

1 Like