[icinga-checkins] icinga.org: icingaweb2/feature/allow-to-restart-the-wizard-9658: WebWizard : Add removeToken option to method clearSession

git at icinga.org git at icinga.org
Wed Dec 21 15:57:00 CET 2016


Module: icingaweb2
Branch: feature/allow-to-restart-the-wizard-9658
Commit: 8e1fbd2cf611223c59abe10a9e3fe5703626630f
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=8e1fbd2cf611223c59abe10a9e3fe5703626630f

Author: Noah Hilverling <noah.hilverling at netways.de>
Date:   Wed Dec 21 15:56:35 2016 +0100

WebWizard: Add removeToken option to method clearSession

refs #9658

---

 .../setup/application/controllers/IndexController.php    |    2 +-
 modules/setup/library/Setup/WebWizard.php                |   14 +++++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/modules/setup/application/controllers/IndexController.php b/modules/setup/application/controllers/IndexController.php
index 685385e..9a3158a 100644
--- a/modules/setup/application/controllers/IndexController.php
+++ b/modules/setup/application/controllers/IndexController.php
@@ -53,7 +53,7 @@ class IndexController extends Controller
     public function restartAction()
     {
         $wizard = new WebWizard();
-        $wizard->clearSession();
+        $wizard->clearSession(true);
         $this->redirectNow('setup');
     }
 }
diff --git a/modules/setup/library/Setup/WebWizard.php b/modules/setup/library/Setup/WebWizard.php
index 82a7ca5..66e103b 100644
--- a/modules/setup/library/Setup/WebWizard.php
+++ b/modules/setup/library/Setup/WebWizard.php
@@ -380,15 +380,19 @@ class WebWizard extends Wizard implements SetupWizard
     }
 
     /**
-     * Clear the session being used by this wizard and drop the setup token
+     * Clear the session being used by this wizard
+     *
+     * @param   bool    $removeToken    If true, the setup token will be removed
      */
-    public function clearSession()
+    public function clearSession($removeToken = true)
     {
         parent::clearSession();
 
-        $tokenPath = Config::resolvePath('setup.token');
-        if (file_exists($tokenPath)) {
-            @unlink($tokenPath);
+        if ($removeToken) {
+            $tokenPath = Config::resolvePath('setup.token');
+            if (file_exists($tokenPath)) {
+                @unlink($tokenPath);
+            }
         }
     }
 



More information about the icinga-checkins mailing list