Skip to content

Commit 2de842a

Browse files
committed
add migration instructions
1 parent ce49c05 commit 2de842a

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,55 @@ rm "$prod" && ln -s "$old" "$prod"
120120
- the `user_created ` mail template has been renamed to `user_qualified`
121121
- the `user_dequalified` mail template has been added
122122

123+
In v1.2.1, we extended PI group requests and PI group join requests to store user info like name and email.
124+
This was necessary because LDAP entries were not created for users until they became "qualified" (become a PI or joined a PI group).
125+
While a user was unqualified, if the Redis cache was cleared, the user info would be lost.
126+
Now, LDAP entries are created immediately for every user, so this is no longer necessary.
127+
128+
- Shut down the web portal
129+
```shell
130+
systemctl stop apache2
131+
```
132+
- Create LDAP entries for all existing requests
133+
```php
134+
use UnityWebPortal\lib\UnityUser;
135+
$_SERVER["HTTP_HOST"] = "worker"; // see deployment/overrides/worker/
136+
$_SERVER["REMOTE_ADDR"] = "127.0.0.1";
137+
require_once __DIR__ . "/../resources/autoload.php";
138+
foreach ($SQL->getAllRequests() as $request) {
139+
$user = new UnityUser(
140+
$request["uid"],
141+
$LDAP,
142+
$SQL,
143+
$MAILER,
144+
$REDIS,
145+
$WEBHOOK,
146+
);
147+
if (!$user->exists()) {
148+
echo "creating user: " . jsonEncode($request) . "\n";
149+
$user->init(
150+
$request["firstname"],
151+
$request["lastname"],
152+
$request["email"],
153+
$request["org"],
154+
);
155+
}
156+
}
157+
```
158+
- Remove columns from the `requests` table:
159+
```sql
160+
ALTER TABLE `requests`
161+
DROP COLUMN `firstname`,
162+
DROP COLUMN `lastname`,
163+
DROP COLUMN `email`,
164+
DROP COLUMN `org`;
165+
```
166+
- Update the portal PHP code following the normal procedure
167+
- Start the portal again
168+
```shell
169+
systemctl start apache2
170+
```
171+
123172
### 1.2 -> 1.3
124173

125174
- SQL:

0 commit comments

Comments
 (0)