Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.2 and 8.3 Support #11

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions application/controllers/IcingadbimgController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use ipl\Stdlib\Filter;
use ipl\Web\Url;

#[\AllowDynamicProperties]
class IcingadbimgController extends IcingadbGrafanaController
{
protected $host;
Expand Down Expand Up @@ -49,7 +48,13 @@ class IcingadbimgController extends IcingadbGrafanaController
protected $cacheTime;
protected $defaultdashboarduid;
protected $refresh = "yes";

protected $customVars;
protected $timerangeto;
protected $object;
protected $dashboard;
protected $dashboarduid;
protected $panelId;
protected $orgId;

public function init()
{
Expand All @@ -66,7 +71,7 @@ public function init()
if ($this->hasParam('timerangeto')) {
$this->timerangeto = urldecode($this->getParam('timerangeto'));
} else {
$this->timerangeto = strpos($this->timerange, '/') ? 'now-' . $this->timerange : "now";
$this->timerangeto = strpos($this->timerange ?? '', '/') ? 'now-' . $this->timerange ?? '' : "now";
}
$this->cacheTime = $this->hasParam('cachetime') ? $this->getParam('cachetime') : 300;

Expand Down Expand Up @@ -326,7 +331,7 @@ private function getMyimageHtml($serviceName, $hostName, &$imageHtml)
return false;
}

$this->pngUrl = sprintf(
$pngUrl = sprintf(
'%s://%s/render/d-solo/%s/%s?var-hostname=%s&var-service=%s&var-command=%s%s&panelId=%s&orgId=%s'
. '&width=%s&height=%s&theme=%s&from=%s&to=%s',
$this->protocol,
Expand All @@ -349,7 +354,7 @@ private function getMyimageHtml($serviceName, $hostName, &$imageHtml)
// fetch image with curl
$curl_handle = curl_init();
$curl_opts = array(
CURLOPT_URL => $this->pngUrl,
CURLOPT_URL => $pngUrl,
CURLOPT_CONNECTTIMEOUT => 2,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_RETURNTRANSFER => true,
Expand Down
2 changes: 2 additions & 0 deletions application/controllers/IcingadbshowController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class IcingadbshowController extends IcingadbGrafanaController
protected $showFullscreen;
protected $host;
protected $custvardisable = "grafana_graph_disable";
protected $config;
protected $object;

public function init()
{
Expand Down
9 changes: 8 additions & 1 deletion library/Grafana/ProvidedHook/Icingadb/IcingaDbGrapher.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ trait IcingaDbGrapher
protected $grafanaVersion = "0";
protected $defaultdashboarduid;
protected $object;
protected $permission;
protected $dashboard;
protected $dashboarduid;
protected $panelId;
protected $orgId;
protected $customVars;
protected $pngUrl;

protected function init()
{
Expand Down Expand Up @@ -236,7 +243,7 @@ private function getGraphConf($serviceName, $serviceCommand = null): ?self
$this->timerange = Url::fromRequest()->hasParam('timerange') ?
'now-' . urldecode(Url::fromRequest()->getParam('timerange')) :
'now-' . $this->getGraphConfigOption($serviceName, 'timerange', $this->timerange);
$this->timerangeto = strpos($this->timerange, '/') ? $this->timerange : $this->timerangeto;
$this->timerangeto = strpos($this->timerange ?? '', '/') ? $this->timerange : $this->timerangeto;
}

$this->height = $this->getGraphConfigOption($serviceName, 'height', $this->height);
Expand Down