Skip to content

Latest commit

 

History

History
126 lines (79 loc) · 4.07 KB

upgrading.md

File metadata and controls

126 lines (79 loc) · 4.07 KB

Upgrading

php-ssl uses numbered SQL migration files to evolve the database schema incrementally. After every git pull that includes new migration files, you must apply any pending migrations.


Upgrading to the public/ directory layout

Web-facing files moved into public/ and the cron entry point moved to cron/cron.php. When you pull this change on an existing installation:

  1. Change the web server document root to <app>/public and add the /route/ rewrite — see Web Server Configuration. nginx installations stop working until this is done. Apache installations keep working through the fallback .htaccess in the application root, but should still be switched.
  2. Update the crontab to /usr/bin/php <app>/cron/cron.php. The old cron.php in the application root has been removed — crontabs still pointing at it will fail.
  3. If PHP open_basedir is set, make sure it covers the application directory, not just public/.

Upgrading to the config/ directory

Configuration files moved from the application root into config/. After pulling this change, move your local config file:

mv config.php config/config.php

Until it is moved, the application shows a Configuration file is missing page that names the file to move, and cron jobs fail. config.dist.php is tracked in git and moves automatically. Both the old (/config.php) and new (/config/config.php) locations are listed in .gitignore.


Migration files

Migrations live in db/migrations/ and are named NNNN_description.sql, for example:

0001_add_changepass_to_users.sql
0002_add_test_to_users.sql
...

Applied migrations are tracked in the migrations database table (by filename). A migration is never applied twice.


Checking for pending migrations

In the UI

A warning banner is shown at the top of every page for admin users when unapplied migrations exist. It links directly to the migration management page.

From the command line

php db/migrate.php status

Output:

DB version : 0023_add_testssl_table.sql
Latest     : 0030_logs_mediumtext.sql
Pending    : 7

Pending migrations:
  - 0024_add_notify_email_to_testssl.sql
  - 0025_cas_tenant_fk.sql
  ...

Applying migrations

From the command line (recommended)

php db/migrate.php

This applies all pending migrations in order and reports success or failure for each.

From the UI

Admins can apply individual migrations from the Database Migrations page in the application.


Keeping SCHEMA.sql in sync

db/SCHEMA.sql is a full dump of the schema and is used by the web installer. After any schema change — whether a new migration file or a direct alteration — regenerate it:

mysqldump --no-data --routines php-ssl > db/SCHEMA.sql

Commit both the migration file and the updated SCHEMA.sql together.


Upgrade procedure summary

git pull
composer install --no-dev
php db/migrate.php

Updating third-party libraries

PHPMailer and Net_DNS2 come from Packagist and can be updated within their version constraints:

composer update --no-dev phpmailer/phpmailer mikepultz/netdns2

testssl.sh is pinned to a release tag. To move to a newer one, change the version, dist.url and source.reference of the testssl/testssl.sh package in composer.json (and the matching require constraint), then run composer update --no-dev testssl/testssl.sh. Commit composer.json and composer.lock.

Upgrading from a version that used git submodules

Older versions shipped Net_DNS2, PHPMailer (functions/assets/) and testssl.sh (functions/testSSL/) as git submodules. After pulling, remove the stale submodule checkouts and install with composer:

git submodule deinit -f --all 2>/dev/null
rm -rf functions/assets/Net_DNS2 functions/assets/PHPMailer functions/testSSL .git/modules
composer install --no-dev

If cron/cron.php is running, migrations are safe to apply while it runs — each migration is a discrete SQL statement and the cron scripts are tenant-scoped.