[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
Thu Dec 22 14:19:19 CET 2016


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

Author: Noah Hilverling <noah.hilverling at netways.de>
Date:   Thu Dec 22 14:18:38 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 a4d5076..9e9f5a6 100644
--- a/modules/setup/application/controllers/IndexController.php
+++ b/modules/setup/application/controllers/IndexController.php
@@ -79,7 +79,7 @@ class IndexController extends Controller
         $form = new Form(array(
             'onSuccess' => function () {
                 $wizard = new WebWizard();
-                $wizard->clearSession();
+                $wizard->clearSession(false);
             }
         ));
         $form->setUidDisabled();
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