From bbb3c11752da17aabb34f936d3a94f9b2cc12e64 Mon Sep 17 00:00:00 2001 From: raviks789 <33730024+raviks789@users.noreply.github.com> Date: Wed, 21 Feb 2024 11:34:23 +0100 Subject: [PATCH] Controller::setupPaginationControl: Avoid using dynamic properties `Icinga\Web\View` as argument --- application/controllers/ConfigController.php | 5 +++-- application/controllers/ListController.php | 5 +++-- application/controllers/RoleController.php | 9 +++++---- .../application/controllers/ShowController.php | 3 ++- .../Web/Controller/MonitoredObjectController.php | 7 ++++--- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/application/controllers/ConfigController.php b/application/controllers/ConfigController.php index 671e1a7d374..02fe2d96b95 100644 --- a/application/controllers/ConfigController.php +++ b/application/controllers/ConfigController.php @@ -129,13 +129,14 @@ public function modulesAction() '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'); } diff --git a/application/controllers/ListController.php b/application/controllers/ListController.php index 2fbc5a93027..50630d0d36b 100644 --- a/application/controllers/ListController.php +++ b/application/controllers/ListController.php @@ -50,10 +50,11 @@ public function applicationlogAction() . 'T[0-9]{2}(?::[0-9]{2}){2}(?:[\+\-][0-9]{2}:[0-9]{2})?)' // time . ' - (?[A-Za-z]+) - (?.*)(?!.)/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'); } } diff --git a/application/controllers/RoleController.php b/application/controllers/RoleController.php index 4223d33976e..b15df7f8877 100644 --- a/application/controllers/RoleController.php +++ b/application/controllers/RoleController.php @@ -59,7 +59,7 @@ public function indexAction() public function listAction() { $this->createListTabs()->activate('role/list'); - $this->view->roles = (new RolesConfig()) + $roles = (new RolesConfig()) ->select(); $sortAndFilterColumns = [ @@ -69,10 +69,11 @@ public function listAction() '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; } /** diff --git a/modules/monitoring/application/controllers/ShowController.php b/modules/monitoring/application/controllers/ShowController.php index f1da5617c7b..3497184cb28 100644 --- a/modules/monitoring/application/controllers/ShowController.php +++ b/modules/monitoring/application/controllers/ShowController.php @@ -6,6 +6,7 @@ use Icinga\Data\Filter\FilterEqual; use Icinga\Module\Monitoring\Backend\MonitoringBackend; use Icinga\Module\Monitoring\Controller; +use Icinga\Module\Monitoring\DataView\DataView; use Icinga\Security\SecurityException; use Icinga\Web\Url; @@ -91,7 +92,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; } diff --git a/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php b/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php index b001ca800c8..b2bd879556a 100644 --- a/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php +++ b/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php @@ -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); }