# Installing Sprint 22

Use this package as the cumulative successor to Sprint 21. Test it on a staging subdomain and staging database before production.

## 1. Back up Sprint 21

Back up the complete application folder, `.env`, private storage and MySQL/MariaDB database.

## 2. Copy the cumulative release

Preserve the package directory structure. The web server document root must remain the `public` directory, not the application root.

## 3. Apply database migration

After migrations `001` through `015` have been applied, import:

```text
database/migrations/016_notifications_email_collaboration.sql
```

Then import:

```text
database/views/016_notifications_collaboration_views.sql
database/seeds/016_branded_email_templates.sql
```

Review all seeded wording before activation.

## 4. Confirm environment settings

Copy new values from `.env.example` without replacing the real `APP_KEY`. Changing `APP_KEY` after SMTP credentials are saved makes those credentials undecryptable.

Required PHP capabilities include:

- PHP 8.2 or newer
- PDO MySQL
- OpenSSL
- libsodium
- JSON
- sockets/stream support

`mbstring` is recommended but the Sprint 22 text helper includes a fallback.

## 5. Assign permissions

Grant only the permissions required by each role:

```text
notifications.view
notifications.manage
collaboration.view
collaboration.message
collaboration.manage
email.manage_config
email.manage_templates
email.manage_queue
reminders.manage
scheduler.run
```

SMTP configuration and queue processing should be limited to trusted administrators.

## 6. Merge React screens

Copy:

```text
frontend-integration/src/notifications-collaboration
```

into the full React/Vite source and register these routes:

```text
NotificationCentrePage
CollaborationPage
EmailAdministrationPage
```

Keep email administration outside client-facing navigation.

## 7. Configure SMTP

Sign in as an authorized administrator, open the Email Administration screen, enter the company SMTP server details, save the configuration and send a test message. See `SMTP_CONFIGURATION_GUIDE.md`.

## 8. Configure cron

Install the email worker and scheduler cron jobs described in `CRON_AND_QUEUE_OPERATIONS.md`.

## 9. Test role separation

Use separate test accounts for:

- Normal employee
- Project manager
- Client user
- Notification administrator
- Collaboration moderator
- Email administrator

Verify that non-participants cannot open conversations and ordinary users cannot see SMTP credentials or the email queue.

## 10. Run tests

```bash
bash tests/run_sprint22.sh
```

Also run the cumulative regression suite before deployment.
