Skip to content

Commit 89fc4d2

Browse files
committed
fixed cookie migration script
1 parent e360958 commit 89fc4d2

1 file changed

Lines changed: 20 additions & 9 deletions

File tree

src/main/resources/migration_redirect.php

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// location to redirect to, with trailing slash and history endpoint path
1212
define("REDIRECT_LOCATION", WEBCAT_LOCATION . "/rest/history/");
1313
// Show information page first and not directly redirect via HTTP header
14-
define("SHOW_INFO_PAGE", false);
14+
define("SHOW_INFO_PAGE", true);
1515

1616
// path of the current workspace
1717
define("COOKIE_PATH", "combinearchiveweba");
@@ -27,17 +27,20 @@
2727
if( isset($_COOKIE[COOKIE_HISTORY]) and $_COOKIE[COOKIE_HISTORY] != "" ) {
2828
// history cookie is set -> decode it
2929
$history = base64_decode($_COOKIE[COOKIE_HISTORY]);
30-
$history = json_decode($history);
30+
$history = json_decode($history, true);
3131

3232
$result = array();
33+
$names = array();
3334
foreach( $history as $history_entry ) {
3435
if( isset($history_entry['current']) and $history_entry['current'] == true ) {
3536
// this entry is the current workspace entry, so put it on the beginning of the result array
36-
array_unshift( $result, $history_entry );
37+
array_unshift( $result, $history_entry["workspaceId"] );
38+
$names[$history_entry["workspaceId"]] = $history_entry["name"];
3739
}
3840
else {
3941
// normal, not current, entry.
40-
array_push( $result, $history_entry );
42+
array_push( $result, $history_entry["workspaceId"] );
43+
$names[$history_entry["workspaceId"]] = $history_entry["name"];
4144
}
4245
}
4346

@@ -61,10 +64,10 @@
6164
.frame { width: 570px; height: 100%; margin: 0 auto; padding: 2em 5px; text-align: left; background-color: #EEE; border: 1px solid #AAA; border-style: none solid none solid; }
6265
.content { }
6366
h1 { width: 100%; font 1.5em bold; line-height: 1.05em; margin-bottom: 2em; }
64-
p { margin-bottom: 3em; padding: 0 5px; text-align: justify; }
67+
p, div.ws-list { margin-bottom: 3em; padding: 0 5px; text-align: justify; }
6568
p.button { text-align: center; }
6669
a.button { display: box; padding: 0.5em 1em; color: #FFF; background-color: #0D0; text-align: center; vertical-align: center; font: 1.3em bold; text-decoration: none; }
67-
a.button:hover { background-color: #F00 !important; }
70+
a.button:hover { background-color: #090 !important; }
6871
</style>
6972
</head>
7073

@@ -82,17 +85,25 @@
8285
It does not seem, that you do not had any workspaces stored at this place. So you can just click at the button below to
8386
access webCAT at the new domain.
8487
<?php } ?>
88+
8589
</p>
90+
8691
<p class="button">
8792
<a class="button" href="<?php echo($redirect_url); ?>"><?php echo($success ? "Migrate Workspaces" : "Go to new Instance"); ?></a>
8893
</p>
94+
8995
<?php if($success) { ?>
90-
<p class="ws-list">
96+
<div class="ws-list">
9197
Following workspaces were found:
9298
<ul>
93-
<?php foreach( $result as $entry ) { ?><li><code><?php echo($entry); ?></code></li><?php } ?>
99+
<?php foreach( $result as $entry ) { ?>
100+
<li>
101+
<?php echo($names[$entry]); ?><br />
102+
<code><?php echo($entry); ?></code>
103+
</li>
104+
<?php } ?>
94105
</ul>
95-
</p>
106+
</div>
96107
<?php } ?>
97108
</div>
98109
</div>

0 commit comments

Comments
 (0)