From d35219c485e3b02a368be6c0bceadc2697b60727 Mon Sep 17 00:00:00 2001 From: Marcin Haba Date: Sun, 28 Sep 2014 10:46:24 +0200 Subject: [PATCH] baculum: Improve stability by replace framework session calls to raw PHP sessions --- gui/baculum/protected/Class/BaculumPage.php | 6 +++--- .../protected/Pages/ConfigurationWizard.php | 4 ++-- gui/baculum/protected/Portlets/ClientList.php | 2 +- gui/baculum/protected/Portlets/JobList.php | 2 +- gui/baculum/protected/Portlets/JobRunList.php | 2 +- gui/baculum/protected/Portlets/PoolList.php | 2 +- gui/baculum/protected/Portlets/Portlets.php | 2 +- gui/baculum/protected/Portlets/SlideWindow.php | 16 ++++++++-------- gui/baculum/protected/Portlets/StorageList.php | 2 +- gui/baculum/protected/Portlets/VolumeList.php | 2 +- gui/baculum/protected/application.xml | 1 - 11 files changed, 20 insertions(+), 21 deletions(-) diff --git a/gui/baculum/protected/Class/BaculumPage.php b/gui/baculum/protected/Class/BaculumPage.php index 1c9bcd3773..1ad9ed6e51 100644 --- a/gui/baculum/protected/Class/BaculumPage.php +++ b/gui/baculum/protected/Class/BaculumPage.php @@ -28,11 +28,11 @@ class BaculumPage extends TPage } public function getLanguage() { - if(isset($this->Session['language']) && !empty($this->Session['language'])) { - $language = $this->Session['language']; + if(isset($_SESSION['language']) && !empty($_SESSION['language'])) { + $language = $_SESSION['language']; } else { $language = $this->getModule('configuration')->getLanguage(); - $this->Session['language'] = $language; + $_SESSION['language'] = $language; } return $language; } diff --git a/gui/baculum/protected/Pages/ConfigurationWizard.php b/gui/baculum/protected/Pages/ConfigurationWizard.php index 7c0be6720d..84ea1bad63 100644 --- a/gui/baculum/protected/Pages/ConfigurationWizard.php +++ b/gui/baculum/protected/Pages/ConfigurationWizard.php @@ -38,7 +38,7 @@ class ConfigurationWizard extends BaculumPage public function onInit($param) { parent::onInit($param); - $this->Lang->SelectedValue = $this->Session['language']; + $this->Lang->SelectedValue = $_SESSION['language']; $this->firstRun = !$this->getModule('configuration')->isApplicationConfig(); $this->applicationConfig = $this->getModule('configuration')->getApplicationConfig(); if($this->firstRun === false && $this->User->getIsAdmin() === false) { @@ -175,7 +175,7 @@ class ConfigurationWizard extends BaculumPage } public function setLang($sender, $param) { - $this->Session['language'] = $sender->SelectedValue; + $_SESSION['language'] = $sender->SelectedValue; $this->goToPage('ConfigurationWizard'); } diff --git a/gui/baculum/protected/Portlets/ClientList.php b/gui/baculum/protected/Portlets/ClientList.php index 5d3d5dadda..021c7a10b6 100644 --- a/gui/baculum/protected/Portlets/ClientList.php +++ b/gui/baculum/protected/Portlets/ClientList.php @@ -40,7 +40,7 @@ class ClientList extends Portlets { if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) { $params = $this->getUrlParams('clients', $this->getPage()->ClientWindow->ID); $clients = $this->Application->getModule('api')->get($params); - $isDetailView = $this->Session['view' . $this->getPage()->ClientWindow->ID] == 'details'; + $isDetailView = $_SESSION['view' . $this->getPage()->ClientWindow->ID] == 'details'; $clientsList = $this->Application->getModule('misc')->objectToArray($clients->output); $this->RepeaterShow->Visible = !$isDetailView; $this->Repeater->DataSource = $isDetailView === false ? $clientsList : array(); diff --git a/gui/baculum/protected/Portlets/JobList.php b/gui/baculum/protected/Portlets/JobList.php index d84bda5b1d..3ce0091d6e 100644 --- a/gui/baculum/protected/Portlets/JobList.php +++ b/gui/baculum/protected/Portlets/JobList.php @@ -85,7 +85,7 @@ class JobList extends Portlets { if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) { $params = $this->getUrlParams('jobs', $this->getPage()->JobWindow->ID); $jobs = $this->Application->getModule('api')->get($params); - $isDetailView = $this->Session['view' . $this->getPage()->JobWindow->ID] == 'details'; + $isDetailView = $_SESSION['view' . $this->getPage()->JobWindow->ID] == 'details'; $this->RepeaterShow->Visible = !$isDetailView; $this->Repeater->DataSource = $isDetailView == false ? $jobs->output : array(); $this->Repeater->dataBind(); diff --git a/gui/baculum/protected/Portlets/JobRunList.php b/gui/baculum/protected/Portlets/JobRunList.php index 0ad8c41711..c0af626398 100644 --- a/gui/baculum/protected/Portlets/JobRunList.php +++ b/gui/baculum/protected/Portlets/JobRunList.php @@ -48,7 +48,7 @@ class JobRunList extends Portlets { $params = $this->getUrlParams(array('jobs', 'tasks'), $this->getPage()->JobRunWindow->ID); $jobTasks = $this->Application->getModule('api')->get($params)->output; $jobs = $this->prepareJobs($jobTasks); - $isDetailView = $this->Session['view' . $this->getPage()->JobRunWindow->ID] == 'details'; + $isDetailView = $_SESSION['view' . $this->getPage()->JobRunWindow->ID] == 'details'; $this->RepeaterShow->Visible = !$isDetailView; $this->Repeater->DataSource = $isDetailView === false ? $jobs : array(); $this->Repeater->dataBind(); diff --git a/gui/baculum/protected/Portlets/PoolList.php b/gui/baculum/protected/Portlets/PoolList.php index 4e4944b962..240e63ca51 100644 --- a/gui/baculum/protected/Portlets/PoolList.php +++ b/gui/baculum/protected/Portlets/PoolList.php @@ -39,7 +39,7 @@ class PoolList extends Portlets { if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) { $params = $this->getUrlParams('pools', $this->getPage()->PoolWindow->ID); $pools = $this->Application->getModule('api')->get($params); - $isDetailView = $this->Session['view' . $this->getPage()->PoolWindow->ID] == 'details'; + $isDetailView = $_SESSION['view' . $this->getPage()->PoolWindow->ID] == 'details'; $this->RepeaterShow->Visible = !$isDetailView; $this->Repeater->DataSource = $isDetailView === false ? $pools->output : array(); $this->Repeater->dataBind(); diff --git a/gui/baculum/protected/Portlets/Portlets.php b/gui/baculum/protected/Portlets/Portlets.php index db24c93479..9c15722cc7 100644 --- a/gui/baculum/protected/Portlets/Portlets.php +++ b/gui/baculum/protected/Portlets/Portlets.php @@ -23,7 +23,7 @@ class Portlets extends TTemplateControl { const SORT_DESC = 'desc'; protected function getUrlParams($section, $id) { - $limit = $this->Session['limit' . $id]; + $limit = $_SESSION['limit' . $id]; if(is_numeric($limit)) { if(is_array($section)) { array_push($section, 'limit', $limit); diff --git a/gui/baculum/protected/Portlets/SlideWindow.php b/gui/baculum/protected/Portlets/SlideWindow.php index 56a8c59768..ea2b0fa447 100644 --- a/gui/baculum/protected/Portlets/SlideWindow.php +++ b/gui/baculum/protected/Portlets/SlideWindow.php @@ -39,9 +39,9 @@ class SlideWindow extends Portlets { public function onInit($param) { parent::onInit($param); - if(empty($this->Session['view' . $this->getParent()->ID]) && empty($this->Session['limit' . $this->getParent()->ID])) { - $this->Session['view' . $this->getParent()->ID] = self::NORMAL_VIEW; - $this->Session['limit' . $this->getParent()->ID] = 'unlimited'; + if(empty($_SESSION['view' . $this->getParent()->ID]) && empty($_SESSION['limit' . $this->getParent()->ID])) { + $_SESSION['view' . $this->getParent()->ID] = self::NORMAL_VIEW; + $_SESSION['limit' . $this->getParent()->ID] = 'unlimited'; } } @@ -49,16 +49,16 @@ class SlideWindow extends Portlets { parent::onLoad($param); if(!$this->getPage()->IsPostBack) { $this->Limit->dataSource = array_combine($this->elementsLimits, $this->elementsLimits); - $this->Limit->SelectedValue = $this->Session['limit' . $this->getParent()->ID]; + $this->Limit->SelectedValue = $_SESSION['limit' . $this->getParent()->ID]; $this->Limit->dataBind(); - $this->Simple->Checked = ($this->Session['view' . $this->getParent()->ID] == self::NORMAL_VIEW); - $this->Details->Checked = ($this->Session['view' . $this->getParent()->ID] == self::DETAIL_VIEW); + $this->Simple->Checked = ($_SESSION['view' . $this->getParent()->ID] == self::NORMAL_VIEW); + $this->Details->Checked = ($_SESSION['view' . $this->getParent()->ID] == self::DETAIL_VIEW); } } public function switchView($sender, $param) { - $this->Session['view' . $this->getParent()->ID] = ($this->Simple->Checked === true) ? self::NORMAL_VIEW : self::DETAIL_VIEW; - $this->Session['limit' . $this->getParent()->ID] = $this->Limit->SelectedValue; + $_SESSION['view' . $this->getParent()->ID] = ($this->Simple->Checked === true) ? self::NORMAL_VIEW : self::DETAIL_VIEW; + $_SESSION['limit' . $this->getParent()->ID] = $this->Limit->SelectedValue; $this->getParent()->prepareData(true); } } diff --git a/gui/baculum/protected/Portlets/StorageList.php b/gui/baculum/protected/Portlets/StorageList.php index 20154272f8..14c2309ad4 100644 --- a/gui/baculum/protected/Portlets/StorageList.php +++ b/gui/baculum/protected/Portlets/StorageList.php @@ -39,7 +39,7 @@ class StorageList extends Portlets { if(in_array($this->getPage()->CallBackEventTarget->ID, $allowedButtons) || $forceReload) { $params = $this->getUrlParams('storages', $this->getPage()->StorageWindow->ID); $storages = $this->Application->getModule('api')->get($params); - $isDetailView = $this->Session['view' . $this->getPage()->StorageWindow->ID] == 'details'; + $isDetailView = $_SESSION['view' . $this->getPage()->StorageWindow->ID] == 'details'; $this->RepeaterShow->Visible = !$isDetailView; $this->Repeater->DataSource = $isDetailView === false ? $storages->output : array(); $this->Repeater->dataBind(); diff --git a/gui/baculum/protected/Portlets/VolumeList.php b/gui/baculum/protected/Portlets/VolumeList.php index 7d6e2bc42f..dbf7739322 100644 --- a/gui/baculum/protected/Portlets/VolumeList.php +++ b/gui/baculum/protected/Portlets/VolumeList.php @@ -44,7 +44,7 @@ class VolumeList extends Portlets { $params = $this->getUrlParams('volumes', $this->getPage()->VolumeWindow->ID); array_push($params, '?showpools=1'); $volumes = $this->Application->getModule('api')->get($params); - $isDetailView = $this->Session['view' . $this->getPage()->VolumeWindow->ID] == 'details'; + $isDetailView = $_SESSION['view' . $this->getPage()->VolumeWindow->ID] == 'details'; $this->RepeaterShow->Visible = !$isDetailView; $this->Repeater->DataSource = $volumes->output; $this->Repeater->dataBind(); diff --git a/gui/baculum/protected/application.xml b/gui/baculum/protected/application.xml index 11bd376c50..a7bed824af 100644 --- a/gui/baculum/protected/application.xml +++ b/gui/baculum/protected/application.xml @@ -88,7 +88,6 @@ - -- 2.39.5