Upgrading from 3.8 to 3.9¶
Traq 3.9 is a big release under the hood. Upgrading from 3.8 isn't only "upload the new files and run the upgrader". Your configuration, plugins, themes and locales have moved, and plugins and themes written for 3.8 need updating.
This guide covers everything you need to move. For the general upgrade steps, see Upgrading Traq.
What changed¶
| Traq 3.8 | Traq 3.9 | |
|---|---|---|
| PHP | 8.3+ | 8.4+ |
| Config files | vendor/traq/config/ |
data/config/ |
| Plugins you install | vendor/traq/plugins/ |
data/plugins/ |
| Themes you install | vendor/traq/views/ |
data/themes/ |
| Custom locales | vendor/traq/locale/ |
data/locale/ |
| Bundled plugins | vendor/traq/plugins/ |
src/Traq/Plugins/ |
| Default theme | vendor/traq/views/default/ |
src/views/default/ |
| Private tickets | Supported | Removed, see below |
The vendor/traq directory no longer exists in 3.9. Everything you add or change now goes in the data directory.
The upgrader only changes the database
The upgrade script migrates your database. It does not move any of your files. Do the file steps below yourself, ideally before you open Traq for the first time after uploading 3.9.
Before you start¶
- Check your PHP version. Traq 3.9 needs PHP 8.4 or newer. Ask your host to upgrade if needed.
- Back up your database.
The 3.9 database migration can't be undone, and it removes some orphaned data (see What the database upgrade does).mysqldump -u YOUR_DB_USER -p YOUR_DB_NAME > traq_backup.sql - Back up your files. At the least:
# Run this from your Traq project root zip -r traq_backup.zip vendor/traq/config/ vendor/traq/plugins/ vendor/traq/views/ vendor/traq/locale/ - Disable third-party plugins. In the 3.8 AdminCP go to Plugins and disable any plugin you installed yourself. Plugins written for 3.8 are not compatible with 3.9 (see Plugins) and one that fails to load can take the whole site down. You can enable them again once you've updated them. The bundled Markdown, Custom Tabs and Security Questions plugins don't need this.
- Switch to the default theme. If you use a custom theme, change Theme to the default in AdminCP → Settings. 3.8 themes need updating too (see Themes).
- Check for private tickets. Traq 3.9 no longer has private tickets (see Private tickets are removed). Find out whether you have any:
If you configured a table prefix, put it in front ofSELECT project_id, COUNT(*) FROM tickets WHERE is_private = 1 GROUP BY project_id;tickets.
Private tickets are removed¶
Traq 3.8 let users mark a ticket as private, so that only administrators, project members and the ticket's creator could see it. Traq 3.9 removes this feature. The "Is private" checkbox is gone from the ticket forms, and 3.9 no longer checks whether a ticket is private when someone views it, lists it or searches for it.
The upgrade doesn't change existing tickets. Tickets that were private in 3.8 keep their flag in the database, but it has no effect: after upgrading, anyone who can view tickets in that project can see them, including guests if guests have view_tickets.
If you have sensitive tickets, deal with them before you upgrade (or before reopening the site to the public):
- Move them to a separate project that only the right people can see. Hide the project from everyone else using the
viewpermission, or - Edit or delete the sensitive content from the tickets, or
- Hold off upgrading until you've decided.
Going forward, restrict access with per-project permissions rather than per-ticket privacy. Use a separate private project for anything confidential.
Step 1: Upload Traq 3.9¶
Download Traq 3.9 and upload it over your existing installation, as described in Upgrading Traq. Don't open Traq in your browser yet.
Step 2: Move your configuration¶
Copy your config files into data/config/:
| From | To |
|---|---|
vendor/traq/config/database.php |
data/config/database.php |
vendor/traq/config/mailer.php (if you have one) |
data/config/mailer.php |
Do this before visiting your site
If Traq can't find data/config/database.php it thinks it isn't installed and sends you to the installer. Don't run the installer. Copy your database.php across instead.
Both files keep the same format, so you don't need to edit them. Don't copy vendor/traq/config/routes.php. It was part of Traq itself and isn't used any more.
Keep the database file private: it holds your database password. The installer sets new files to 0640, which you can copy:
chmod 640 data/config/database.php
Mailer¶
Your email settings carry over:
- The From Email, Mailer configuration and Mailer DSN settings are stored in the database and are untouched.
- If you configure email with a
mailer.phpfile (Mailer configuration set to Config file), it must now be atdata/config/mailer.php. Without it Traq falls back to the DSN setting, which defaults tosendmail://default.
After the upgrade, test that notifications still arrive. See Mailer Configuration.
New optional settings¶
3.9 adds an optional data/config/config.php. Copy data/config/config.default.php to start one. The main option is TRAQ_BASE_URL, the URL Traq uses for links in emails and feeds. See Installation.
Step 3: Move your locales¶
If you added your own locale files:
- Copy them from
vendor/traq/locale/todata/locale/. -
Update each file to the new class format. The class name still matches the file name:
// Traq 3.8 namespace traq\locale; class xxXX extends \traq\libraries\Locale // Traq 3.9 namespace Traq\Locale; use Traq\Locale; class xxXX extends Locale
3.9 adds and changes many strings. Start from a copy of src/Traq/Locale/enus.php and re-apply your translations so that nothing shows as a missing string.
Plugins¶
Bundled plugins¶
Markdown, Custom Tabs and Security Questions now live in src/Traq/Plugins/ and keep working. The upgrader renames their entries in the database (markdown → Markdown, custom_tabs → CustomTabs, security_questions → SecurityQuestions), so nothing to do there. Don't copy the old bundled plugin folders from vendor/traq/plugins/ into data/plugins/. A new ReCaptcha plugin is also bundled and can be installed from the plugins page.
Plugins you installed yourself¶
Copy each one from vendor/traq/plugins/ to data/plugins/, then update it for 3.9. Plugins written for 3.8 will not run unchanged.
The folder and main file keep their names (data/plugins/my_plugin/my_plugin.php). The class is found from the folder name just like in 3.8, so you don't need to rename them, though CamelCase names are recommended for new plugins.
The changes you need to make:
| Traq 3.8 | Traq 3.9 |
|---|---|
namespace traq\plugins; |
namespace Traq\Plugins; |
class X extends \traq\libraries\Plugin |
use Traq\Libraries\Plugin; then class X extends Plugin |
use avalon\http\Router; and other lowercase avalon\… classes |
use Avalon\Http\Router;, with Avalon\… in the right case |
Autoloader::registerNamespace('X', __DIR__); |
Remove it. Traq now registers your plugin folder as the X\ namespace automatically |
Router::add('/admin/x', 'X::controllers::admin::Y.index'); |
Router::register('x.index', '/admin/x', [YController::class, 'index']); |
Lowercase controllers/ and models/ folders and snake_case file names (custom_tab.php) |
Folders and files must match the class namespace and name (Controllers/, Models/, CustomTab.php) |
Routes in 3.9 have a unique name and are tied to an HTTP method. Add methods: ['POST'], ['PUT'] or ['DELETE'] for write actions, and use GET (the default) for pages. Controllers in plugins extend Traq's controller classes in the Traq\Controllers namespace.
Views in the plugin's views/ folder are picked up automatically as before. Template hooks are unchanged, but the default theme was reworked in 3.9, so check that your hook still appears where you expect.
See Creating a Plugin and Plugin Hooks for the full 3.9 format. The bundled plugins in src/Traq/Plugins/ (especially Custom Tabs, which has controllers, models, routes and views) are the best examples to follow.
Once a plugin is updated, enable it again in AdminCP → Plugins.
If a plugin breaks the site
A plugin that fails to load causes an error on every page, including the AdminCP. To recover, disable it in the database (add your table prefix if you use one):
UPDATE plugins SET enabled = 0 WHERE file = 'my_plugin';
Themes¶
Themes now live in data/themes/<theme-name>/, and each still needs its _theme.php file that describes it:
return [
'name' => 'My Theme',
'version' => '1.0',
'author' => 'You',
];
3.8 themes won't work unchanged. The default theme was reworked in 3.9. Most of its view files changed, including layouts, ticket pages, the wiki, new escaping of output and new JavaScript behaviour. Traq looks for views in data/themes/<theme>, then src/views/<theme>, then src/views, and it doesn't fall back to the default theme for a file your theme is missing.
The easiest way to port a theme:
- Copy
src/views/default/todata/themes/my-theme/. - Add
_theme.phpif it isn't there. - Re-apply your customisations from your 3.8 theme onto the new files.
- Select it in AdminCP → Settings → Theme.
If you only changed a few files, compare your 3.8 versions against the 3.8 default theme to find out what you changed, then redo those changes on the 3.9 files.
If the site shows errors after upgrading with a custom theme
Set the theme back to the default in the database:
UPDATE settings SET value = 'default' WHERE setting = 'theme';
Step 4: Run the database upgrade¶
Visit your Traq site in your browser. It detects the upgrade and shows the upgrade prompt. If it doesn't, go to /install/upgrade.php. Follow the prompt to run the migration.
If you see "Config file not found", Traq can't find data/config/database.php, so go back to Step 2.
What the database upgrade does¶
- Renames the bundled plugin entries (see Plugins) and removes duplicate plugin entries.
- Makes the ticket milestone, version, component and assignee fields optional, and turns any stored
0values into "none". - Repairs tickets pointing at things that no longer exist: an unknown type, priority or severity is changed to the first one available, a missing open status to the first open status, and an invalid version is cleared.
- Deletes orphaned data: tickets, custom fields and timeline events that belong to projects that no longer exist, and ticket history and custom field values for tickets that no longer exist.
- Adds ticket relationship types. Your existing related tickets become two-way "Relates to" links, and a matching reverse link is added.
- Adds database constraints so that tickets can't point at records that don't exist.
- Stores the status name in timeline events instead of its ID.
Warning
The upgrade can't be rolled back automatically. If something goes wrong, restore from your database backup.
Step 5: After upgrading¶
- Clear your browser cache so the new JavaScript and CSS load.
- Check you can log in. Existing passwords and API keys keep working.
- Test email. Trigger a notification and check it arrives.
- Enable your updated plugins, and select your theme again.
- Check your projects. Look at the tickets list, a ticket, the roadmap and the wiki.
- Check permissions. The upgrade doesn't change your groups, roles or permissions. See Permissions, Groups & Roles if you want to review them.
- Clean up. Once everything works, you can delete the old
vendor/traqdirectory andvendor/bootstrap.php, since 3.9 doesn't use them. Keep your backup.
If you upgraded to 3.9.2 or later, password reset and email validation links that were sent before the upgrade stop working, because Traq now stores only a hash of those keys. Users can request a new link.
Troubleshooting¶
| Problem | Likely cause |
|---|---|
| Redirected to the installer | data/config/database.php is missing. Copy it from vendor/traq/config/ |
| "Config file not found" on the upgrade page | Same as above |
| Blank page or errors on every page | An incompatible plugin or theme. See the tips above, and check your PHP version is 8.4+ |
| Emails aren't sent | mailer.php wasn't moved to data/config/, or the mailer settings need checking |
| A locale shows missing strings or errors | Locale file wasn't updated, see Step 3 |