Closed PBXForums closed 2 weeks ago
Maybe this helps:
[previous exception] [object] (ErrorException(code: 0): Undefined property: stdClass::$majorOutage at /var/www/Cachet/vendor/cachethq/core/src/Status.php:57) [stacktrace]
Hey @PBXForums, sorry you're having this issue! Do you have any components currently configured?
Hi,
Yes, I created one component group and one component to test with.
I can confirm that deleting the component fixes it.
Interesting. Can you provide more information on the group and component you're creating that causes this exception? What status does the component have etc?
Just to come back on this issue...
I'm not a programmer but manage to find the following call seemed to have the problem:
return ($this->components()->majorOutage / $this->components()->total) * 100 >= $majorOutageRate;
Looking at the following function I could see that it was an sql query of some sort
public function components()
{
return $this->components ??= Component::query()
->toBase()
->selectRaw('count(*) as total')
->selectRaw('sum(case when status = ? then 1 else 0 end) as operational', [ComponentStatusEnum::operational])
->selectRaw('sum(case when status = ? then 1 else 0 end) as performanceIssues', [ComponentStatusEnum::performance_issues])
->selectRaw('sum(case when status = ? then 1 else 0 end) as partialOutage', [ComponentStatusEnum::partial_outage])
->selectRaw('sum(case when status = ? then 1 else 0 end) as majorOutage', [ComponentStatusEnum::major_outage])
// @todo Handle authenticated users.
->first();
}
I am using postgresql and way back in my memory, I remember something about case sensitivity I had from a problem years ago and so I changed the previous call to:
return ($this->components()->majoroutage / $this->components()->total) * 100 >= $majorOutageRate;
This now seems to work just fine.
I'm probably barking up the wrong tree but it may help.
@PBXForums that sounds like it's the issue! I'll fix this.
This was fixed in cachethq/core.
Hi all, I have just installed version 3.x and after creating a component my status page now gives the above error.
Any ideas where I can begin to look?
TIA Daz