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

Avoid using dynamic properties of Icinga\Web\View as arguments #5191

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
5 changes: 3 additions & 2 deletions application/controllers/ConfigController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

Check failure on line 1 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$query of method Icinga\\Web\\Controller\:\:setupPaginationControl\(\) expects Icinga\\Data\\QueryInterface, null given\.$# in path /home/runner/work/icingaweb2/icingaweb2/application/controllers/ConfigController.php was not matched in reported errors.

Check failure on line 1 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$query of method Icinga\\Web\\Controller\:\:setupPaginationControl\(\) expects Icinga\\Data\\QueryInterface, null given\.$# in path /home/runner/work/icingaweb2/icingaweb2/application/controllers/ConfigController.php was not matched in reported errors.

Check failure on line 1 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$query of method Icinga\\Web\\Controller\:\:setupPaginationControl\(\) expects Icinga\\Data\\QueryInterface, null given\.$# in path /home/runner/work/icingaweb2/icingaweb2/application/controllers/ConfigController.php was not matched in reported errors.

Check failure on line 1 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$query of method Icinga\\Web\\Controller\:\:setupPaginationControl\(\) expects Icinga\\Data\\QueryInterface, null given\.$# in path /home/runner/work/icingaweb2/icingaweb2/application/controllers/ConfigController.php was not matched in reported errors.

Check failure on line 1 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$query of method Icinga\\Web\\Controller\:\:setupPaginationControl\(\) expects Icinga\\Data\\QueryInterface, null given\.$# in path /home/runner/work/icingaweb2/icingaweb2/application/controllers/ConfigController.php was not matched in reported errors.

Check failure on line 1 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$query of method Icinga\\Web\\Controller\:\:setupPaginationControl\(\) expects Icinga\\Data\\QueryInterface, null given\.$# in path /home/runner/work/icingaweb2/icingaweb2/application/controllers/ConfigController.php was not matched in reported errors.

Check failure on line 1 in application/controllers/ConfigController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$query of method Icinga\\Web\\Controller\:\:setupPaginationControl\(\) expects Icinga\\Data\\QueryInterface, null given\.$# in path /home/runner/work/icingaweb2/icingaweb2/application/controllers/ConfigController.php was not matched in reported errors.
/* Icinga Web 2 | (c) 2013 Icinga Development Team | GPLv2+ */

namespace Icinga\Controllers;
Expand Down Expand Up @@ -129,13 +129,14 @@
'url' => 'config/modules'
))
->activate('modules');
$this->view->modules = Icinga::app()->getModuleManager()->select()
$modules = Icinga::app()->getModuleManager()->select()
->from('modules')
->order('enabled', 'desc')
->order('installed', 'asc')
->order('name');
$this->setupLimitControl();
$this->setupPaginationControl($this->view->modules);
$this->setupPaginationControl($modules);
$this->view->modules = $modules;
$this->view->title = $this->translate('Modules');
}

Expand Down
5 changes: 3 additions & 2 deletions application/controllers/ListController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

Check failure on line 1 in application/controllers/ListController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$query of method Icinga\\Web\\Controller\:\:setupPaginationControl\(\) expects Icinga\\Data\\QueryInterface, null given\.$# in path /home/runner/work/icingaweb2/icingaweb2/application/controllers/ListController.php was not matched in reported errors.

Check failure on line 1 in application/controllers/ListController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$query of method Icinga\\Web\\Controller\:\:setupPaginationControl\(\) expects Icinga\\Data\\QueryInterface, null given\.$# in path /home/runner/work/icingaweb2/icingaweb2/application/controllers/ListController.php was not matched in reported errors.

Check failure on line 1 in application/controllers/ListController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$query of method Icinga\\Web\\Controller\:\:setupPaginationControl\(\) expects Icinga\\Data\\QueryInterface, null given\.$# in path /home/runner/work/icingaweb2/icingaweb2/application/controllers/ListController.php was not matched in reported errors.

Check failure on line 1 in application/controllers/ListController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$query of method Icinga\\Web\\Controller\:\:setupPaginationControl\(\) expects Icinga\\Data\\QueryInterface, null given\.$# in path /home/runner/work/icingaweb2/icingaweb2/application/controllers/ListController.php was not matched in reported errors.

Check failure on line 1 in application/controllers/ListController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$query of method Icinga\\Web\\Controller\:\:setupPaginationControl\(\) expects Icinga\\Data\\QueryInterface, null given\.$# in path /home/runner/work/icingaweb2/icingaweb2/application/controllers/ListController.php was not matched in reported errors.

Check failure on line 1 in application/controllers/ListController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$query of method Icinga\\Web\\Controller\:\:setupPaginationControl\(\) expects Icinga\\Data\\QueryInterface, null given\.$# in path /home/runner/work/icingaweb2/icingaweb2/application/controllers/ListController.php was not matched in reported errors.

Check failure on line 1 in application/controllers/ListController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$query of method Icinga\\Web\\Controller\:\:setupPaginationControl\(\) expects Icinga\\Data\\QueryInterface, null given\.$# in path /home/runner/work/icingaweb2/icingaweb2/application/controllers/ListController.php was not matched in reported errors.
/* Icinga Web 2 | (c) 2014 Icinga Development Team | GPLv2+ */

namespace Icinga\Controllers;
Expand Down Expand Up @@ -50,10 +50,11 @@
. 'T[0-9]{2}(?::[0-9]{2}){2}(?:[\+\-][0-9]{2}:[0-9]{2})?)' // time
. ' - (?<loglevel>[A-Za-z]+) - (?<message>.*)(?!.)/msS' // loglevel, message
)));
$this->view->logData = $resource->select()->order('DESC');
$logData = $resource->select()->order('DESC');

$this->setupLimitControl();
$this->setupPaginationControl($this->view->logData);
$this->setupPaginationControl($logData);
$this->view->logData = $logData;
$this->view->title = $this->translate('Application Log');
}
}
9 changes: 5 additions & 4 deletions application/controllers/RoleController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

Check failure on line 1 in application/controllers/RoleController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.3 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$query of method Icinga\\Web\\Controller\:\:setupPaginationControl\(\) expects Icinga\\Data\\QueryInterface, null given\.$# in path /home/runner/work/icingaweb2/icingaweb2/application/controllers/RoleController.php was not matched in reported errors.

Check failure on line 1 in application/controllers/RoleController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$query of method Icinga\\Web\\Controller\:\:setupPaginationControl\(\) expects Icinga\\Data\\QueryInterface, null given\.$# in path /home/runner/work/icingaweb2/icingaweb2/application/controllers/RoleController.php was not matched in reported errors.

Check failure on line 1 in application/controllers/RoleController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.2 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$query of method Icinga\\Web\\Controller\:\:setupPaginationControl\(\) expects Icinga\\Data\\QueryInterface, null given\.$# in path /home/runner/work/icingaweb2/icingaweb2/application/controllers/RoleController.php was not matched in reported errors.

Check failure on line 1 in application/controllers/RoleController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$query of method Icinga\\Web\\Controller\:\:setupPaginationControl\(\) expects Icinga\\Data\\QueryInterface, null given\.$# in path /home/runner/work/icingaweb2/icingaweb2/application/controllers/RoleController.php was not matched in reported errors.

Check failure on line 1 in application/controllers/RoleController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.0 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$query of method Icinga\\Web\\Controller\:\:setupPaginationControl\(\) expects Icinga\\Data\\QueryInterface, null given\.$# in path /home/runner/work/icingaweb2/icingaweb2/application/controllers/RoleController.php was not matched in reported errors.

Check failure on line 1 in application/controllers/RoleController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 8.1 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$query of method Icinga\\Web\\Controller\:\:setupPaginationControl\(\) expects Icinga\\Data\\QueryInterface, null given\.$# in path /home/runner/work/icingaweb2/icingaweb2/application/controllers/RoleController.php was not matched in reported errors.

Check failure on line 1 in application/controllers/RoleController.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \$query of method Icinga\\Web\\Controller\:\:setupPaginationControl\(\) expects Icinga\\Data\\QueryInterface, null given\.$# in path /home/runner/work/icingaweb2/icingaweb2/application/controllers/RoleController.php was not matched in reported errors.
/* Icinga Web 2 | (c) 2014 Icinga Development Team | GPLv2+ */

namespace Icinga\Controllers;
Expand Down Expand Up @@ -59,7 +59,7 @@
public function listAction()
{
$this->createListTabs()->activate('role/list');
$this->view->roles = (new RolesConfig())
$roles = (new RolesConfig())
->select();

$sortAndFilterColumns = [
Expand All @@ -69,10 +69,11 @@
'permissions' => $this->translate('Permissions')
];

$this->setupFilterControl($this->view->roles, $sortAndFilterColumns, ['name']);
$this->setupFilterControl($roles, $sortAndFilterColumns, ['name']);
$this->setupLimitControl();
$this->setupPaginationControl($this->view->roles);
$this->setupSortControl($sortAndFilterColumns, $this->view->roles, ['name']);
$this->setupPaginationControl($roles);
$this->setupSortControl($sortAndFilterColumns, $roles, ['name']);
$this->view->roles = $roles;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function contactAction()
$this->applyRestriction('monitoring/filter/objects', $notifications);
$this->view->notifications = $notifications;
$this->setupLimitControl();
$this->setupPaginationControl($this->view->notifications);
$this->setupPaginationControl($notifications);
$this->view->title = $contact->contact_name;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,12 @@ public function showAction()
public function historyAction()
{
$this->getTabs()->activate('history');
$this->view->history = $this->object->fetchEventhistory()->eventhistory;
$this->applyRestriction('monitoring/filter/objects', $this->view->history);
$history = $this->object->fetchEventhistory()->eventhistory;
$this->applyRestriction('monitoring/filter/objects', $history);

$this->setupLimitControl(50);
$this->setupPaginationControl($this->view->history, 50);
$this->setupPaginationControl($history, 50);
$this->view->history = $history;
$this->view->object = $this->object;
$this->render('object/detail-history', null, true);
}
Expand Down
Loading