Skip to content

[3.0] Miscellaneous fixes for the installer and upgrader#9162

Open
Sesquipedalian wants to merge 14 commits intoSimpleMachines:release-3.0from
Sesquipedalian:3.0/upgrader
Open

[3.0] Miscellaneous fixes for the installer and upgrader#9162
Sesquipedalian wants to merge 14 commits intoSimpleMachines:release-3.0from
Sesquipedalian:3.0/upgrader

Conversation

@Sesquipedalian
Copy link
Member

@Sesquipedalian Sesquipedalian commented Mar 20, 2026

Fixes a bunch of stuff that has come up while testing the installer and upgrader.

@sbulen, we can use this PR to do all our testing to get 2.1 → 3.0 and 2.0 -> 3.0 upgrades fully working, as well as deal with any issues in the installer. Then we'll go back to #9120 afterward.

@sbulen
Copy link
Contributor

sbulen commented Mar 20, 2026

So... Test here next???

@sbulen
Copy link
Contributor

sbulen commented Mar 20, 2026

On this PR... Results are actually very good. Only a couple minor nits & questions.

2.1 => 3.0:

  • OK, no issues

Install: Ran fine. Only minor nits...

  • IIRC(?), In the past, if you didn't specify install.php in the url to invoke, but it was there, it would still run the installer. Now you have to explicitly invoke install.php - or you get an "Unable to establish connection" WSOD. A change in behavior, I think. Upgrader is detected OK.
  • Server Name doesn't pre-populate anymore... It's blank & you have to populate it.

General observations... These are both maybe just me & my system, not sure... Any thoughts would be welcome.

  • Installs & upgrades, especially on the initial welcome/config screens, are VERY VERY slow to paint... Doesn't feel normal. Once it starts it's OK. But it takes a while to get there. I've disabled xdebug, etc., things that normally slow down. Still crazy slow.
  • I haven't been able to get self-signed certs to be detected & work properly.

I think the performance is actually a 3.0 thing. I don't see that elsewhere.

I think the self-signed cert is a me thing... I see that elsewhere. No matter what I've tried, if I try to force https, I get sslRedirect within the app. And the installer never detects the cert, e.g., the ssl box is grayed out. I hate putzing with certs...

@sbulen
Copy link
Contributor

sbulen commented Mar 20, 2026

I'd be OK with this going in as-is. Only nits.

@sbulen
Copy link
Contributor

sbulen commented Mar 20, 2026

I could dive deeper & try 2.0 upgrades if needed.
And postgresql.
And I have MariaDB on a different port, that too.

Sound like a plan?

@Sesquipedalian
Copy link
Member Author

Install: Ran fine. Only minor nits...

  • IIRC(?), In the past, if you didn't specify install.php in the url to invoke, but it was there, it would still run the installer. Now you have to explicitly invoke install.php - or you get an "Unable to establish connection" WSOD. A change in behavior, I think. Upgrader is detected OK.

Hm. That's not good.

  • Server Name doesn't pre-populate anymore... It's blank & you have to populate it.

Should be an easy fix.

General observations... These are both maybe just me & my system, not sure... Any thoughts would be welcome.

  • Installs & upgrades, especially on the initial welcome/config screens, are VERY VERY slow to paint... Doesn't feel normal. Once it starts it's OK. But it takes a while to get there. I've disabled xdebug, etc., things that normally slow down. Still crazy slow.

I haven't noticed that in my tests, but I wasn't particularly looking for it either.

  • I haven't been able to get self-signed certs to be detected & work properly.

Yeah, that's probably just a you thing.

Rather than a self-signed certificate, why not just use one from Let's Encrypt?

@Sesquipedalian
Copy link
Member Author

I could dive deeper & try 2.0 upgrades if needed.

And postgresql.

And I have MariaDB on a different port, that too.

Sound like a plan?

Sounds like a great plan! Thanks, @sbulen. 😊

@sbulen
Copy link
Contributor

sbulen commented Mar 20, 2026

Rather than a self-signed certificate, why not just use one from Let's Encrypt?

Most of my testing is on localhost. Once things progress, I do final testing on a hosted test environment.

For a long time, no issues whatsoever, but browsers have been getting more picky over time. For years, a self-signed cert worked perfectly. Until it didn't... For a while there, I had to create my own CA for local use. Now, that is either unsupported, or, I'm doing it wrong...

@sbulen
Copy link
Contributor

sbulen commented Mar 20, 2026

2.0 latin1 => 3.0:

image

php/apache/mysql logs: Nothing

upgrader log:

2026-03-20T17:03:48+00:00
Step 1: Login
Making sure SMF can write to "D:\wamp64\www\van2021\Settings.php"... done.
Making sure SMF can write to "D:\wamp64\www\van2021\Settings_bak.php"... done.
Making sure SMF can write to "D:\wamp64\www\van2021/custom_avatar"... done.
Making sure SMF can write to "D:\wamp64\www\van2021/cache/db_last_error.php"... done.
Step 2: Upgrade Options
Saving the following settings in the settings table: enable_sm_stats and force_ssl... done.
Step 4: Migrations
+++ Fixing sequences (PostgreSQL)... skipped.
+++ Add find_in_set function (PostgreSQL)... skipped.
+++ Time and date fixes... skipped.
+++ Adding new settings... done.
+++ Removing karma... done.
+++ Fixing dates... done.
+++ Creating login history table... done.
+++ Converting collapsed categories... done.
+++ Parsing board descriptions and names...

2.0 utf8 => 3.0:

image

php/apache/mysql logs: Nothing

upgrader log:

2026-03-20T17:10:12+00:00
Step 1: Login
Step 2: Upgrade Options
Saving the following settings in the settings table: enable_sm_stats and force_ssl... done.
Saving the following settings in Settings.php: db_server and db_port... done.
Step 4: Migrations
+++ Fixing sequences (PostgreSQL)... skipped.
+++ Add find_in_set function (PostgreSQL)... skipped.
+++ Time and date fixes... skipped.
+++ Adding new settings... done.
+++ Removing karma... done.
+++ Fixing dates... done.
+++ Creating login history table... done.
+++ Converting collapsed categories... done.
+++ Parsing board descriptions and names...

pg => 3.0:

image

php/apache/mysql logs: Nothing

upgrader log:

2026-03-20T17:26:46+00:00
Step 1: Login
Making sure SMF can write to "D:\wamp64\www\pgvan2021\Settings.php"... done.
Making sure SMF can write to "D:\wamp64\www\pgvan2021\Settings_bak.php"... done.
Making sure SMF can write to "D:\wamp64\www\pgvan2021/custom_avatar"... done.
Making sure SMF can write to "D:/wamp64/www/pgvan2021/cache/db_last_error.php"... done.
Step 2: Upgrade Options
Saving the following settings in the settings table: enable_sm_stats... done.
Step 4: Migrations
+++ Fixing sequences (PostgreSQL)... failed with error: "ERROR: relation "admin_info_files" does not exist
LINE 1: ...files_seq', (SELECT COALESCE(MAX(id_file),1) FROM admin_info...
^"

MariaDB 11 => 3.0:

image

php/apache/mysql logs: Nothing

upgrader log:

2026-03-20T17:36:50+00:00
Step 1: Login
Making sure SMF can write to "D:\wamp64\www\11van21\Settings.php"... done.
Making sure SMF can write to "D:\wamp64\www\11van21\Settings_bak.php"... done.
Making sure SMF can write to "D:\wamp64\www\11van21/custom_avatar"... done.
Making sure SMF can write to "D:/wamp64/www/11van21/cache/db_last_error.php"... done.
Step 2: Upgrade Options
Saving the following settings in the settings table: enable_sm_stats... done.
Step 4: Migrations
+++ Fixing sequences (PostgreSQL)... skipped.
+++ Add find_in_set function (PostgreSQL)... skipped.
+++ Time and date fixes... skipped.
+++ Adding new settings... done.
+++ Removing karma... skipped.
+++ Fixing dates... done.
+++ Creating login history table... done.
+++ Converting collapsed categories... skipped.
+++ Parsing board descriptions and names... skipped.
+++ Converting legacy attachments... skipped.
+++ Fixing invalid sizes on attachments... done.
+++ Fixing attachment directory setting... skipped.
+++ Adding support for logging who fulfils a group request... done.
+++ Adding new package manager columns... done.
+++ Adding support for validation servers... done.
+++ Adding more space for session ids... done.
+++ Adding support for MOVED topics enhancements... done.
+++ Adding new scheduled tasks... done.
+++ Adding background tasks support... done.
+++ Adding support for category descriptions... done.
+++ Adding support for alerts... done.
+++ Upgrading auto notify setting... done.
+++ Creating alert prefs for watched topics... done.
+++ Creating alert prefs for watched boards... done.
+++ Updating obsolete alerts from before RC3... done.
+++ Adding support for topic unwatch... done.
+++ Fixing mail queue for long messages... done.
+++ Altering the membergroup stars to icons... done.
+++ Updating Theme settings... done.
+++ Upgrade Custom Fields (Preparing)...

@Sesquipedalian
Copy link
Member Author

2.0 latin1 => 3.0:

image php/apache/mysql logs: Nothing

upgrader log:

2026-03-20T17:03:48+00:00
Step 1: Login
Making sure SMF can write to "D:\wamp64\www\van2021\Settings.php"... done.
Making sure SMF can write to "D:\wamp64\www\van2021\Settings_bak.php"... done.
Making sure SMF can write to "D:\wamp64\www\van2021/custom_avatar"... done.
Making sure SMF can write to "D:\wamp64\www\van2021/cache/db_last_error.php"... done.
Step 2: Upgrade Options
Saving the following settings in the settings table: enable_sm_stats and force_ssl... done.
Step 4: Migrations
+++ Fixing sequences (PostgreSQL)... skipped.
+++ Add find_in_set function (PostgreSQL)... skipped.
+++ Time and date fixes... skipped.
+++ Adding new settings... done.
+++ Removing karma... done.
+++ Fixing dates... done.
+++ Creating login history table... done.
+++ Converting collapsed categories... done.
+++ Parsing board descriptions and names...

2.0 utf8 => 3.0:

image php/apache/mysql logs: Nothing

upgrader log:

2026-03-20T17:10:12+00:00
Step 1: Login
Step 2: Upgrade Options
Saving the following settings in the settings table: enable_sm_stats and force_ssl... done.
Saving the following settings in Settings.php: db_server and db_port... done.
Step 4: Migrations
+++ Fixing sequences (PostgreSQL)... skipped.
+++ Add find_in_set function (PostgreSQL)... skipped.
+++ Time and date fixes... skipped.
+++ Adding new settings... done.
+++ Removing karma... done.
+++ Fixing dates... done.
+++ Creating login history table... done.
+++ Converting collapsed categories... done.
+++ Parsing board descriptions and names...

These two should be fixed in the latest commits.

@Sesquipedalian
Copy link
Member Author

Sesquipedalian commented Mar 21, 2026

pg => 3.0:

image php/apache/mysql logs: Nothing

upgrader log:

2026-03-20T17:26:46+00:00
Step 1: Login
Making sure SMF can write to "D:\wamp64\www\pgvan2021\Settings.php"... done.
Making sure SMF can write to "D:\wamp64\www\pgvan2021\Settings_bak.php"... done.
Making sure SMF can write to "D:\wamp64\www\pgvan2021/custom_avatar"... done.
Making sure SMF can write to "D:/wamp64/www/pgvan2021/cache/db_last_error.php"... done.
Step 2: Upgrade Options
Saving the following settings in the settings table: enable_sm_stats... done.
Step 4: Migrations
+++ Fixing sequences (PostgreSQL)... failed with error: "ERROR: relation "admin_info_files" does not exist
LINE 1: ...files_seq', (SELECT COALESCE(MAX(id_file),1) FROM admin_info...
^"

Hm. Does the admin_info_files table not exist in the database before the upgrade starts?

@Sesquipedalian
Copy link
Member Author

MariaDB 11 => 3.0:

image php/apache/mysql logs: Nothing

upgrader log:

2026-03-20T17:36:50+00:00
Step 1: Login
Making sure SMF can write to "D:\wamp64\www\11van21\Settings.php"... done.
Making sure SMF can write to "D:\wamp64\www\11van21\Settings_bak.php"... done.
Making sure SMF can write to "D:\wamp64\www\11van21/custom_avatar"... done.
Making sure SMF can write to "D:/wamp64/www/11van21/cache/db_last_error.php"... done.
Step 2: Upgrade Options
Saving the following settings in the settings table: enable_sm_stats... done.
Step 4: Migrations
+++ Fixing sequences (PostgreSQL)... skipped.
+++ Add find_in_set function (PostgreSQL)... skipped.
+++ Time and date fixes... skipped.
+++ Adding new settings... done.
+++ Removing karma... skipped.
+++ Fixing dates... done.
+++ Creating login history table... done.
+++ Converting collapsed categories... skipped.
+++ Parsing board descriptions and names... skipped.
+++ Converting legacy attachments... skipped.
+++ Fixing invalid sizes on attachments... done.
+++ Fixing attachment directory setting... skipped.
+++ Adding support for logging who fulfils a group request... done.
+++ Adding new package manager columns... done.
+++ Adding support for validation servers... done.
+++ Adding more space for session ids... done.
+++ Adding support for MOVED topics enhancements... done.
+++ Adding new scheduled tasks... done.
+++ Adding background tasks support... done.
+++ Adding support for category descriptions... done.
+++ Adding support for alerts... done.
+++ Upgrading auto notify setting... done.
+++ Creating alert prefs for watched topics... done.
+++ Creating alert prefs for watched boards... done.
+++ Updating obsolete alerts from before RC3... done.
+++ Adding support for topic unwatch... done.
+++ Fixing mail queue for long messages... done.
+++ Altering the membergroup stars to icons... done.
+++ Updating Theme settings... done.
+++ Upgrade Custom Fields (Preparing)...

Bleh. Please run it again with this modified version of ./Sources/Maintenance/Migration/v2_1/CustomFieldsPart1.php. It will once again dump a bunch of crap into upgrade.log so I can figure out where things are going wrong.

<?php

/**
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines https://www.simplemachines.org
 * @copyright 2026 Simple Machines and individual contributors
 * @license https://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 3.0 Alpha 4
 */

declare(strict_types=1);

namespace SMF\Maintenance\Migration\v2_1;

use SMF\Db\DatabaseApi as Db;
use SMF\Db\Schema;
use SMF\Maintenance\Maintenance;
use SMF\Maintenance\Migration\MigrationBase;

class CustomFieldsPart1 extends MigrationBase
{
	/*******************
	 * Public properties
	 *******************/

	/**
	 *
	 */
	public string $name = 'Upgrade Custom Fields (Preparing)';

	/****************
	 * Public methods
	 ****************/

	/**
	 *
	 */
	public function execute(): bool
	{
		Maintenance::$tool->logProgress(__LINE__, true);
		$start = Maintenance::getCurrentStart();

		if ($start <= 0) {
			$table = new Schema\v2_1\CustomFields();
			Maintenance::$tool->logProgress(__LINE__, true);
			$table->normalize();
			Maintenance::$tool->logProgress(__LINE__, true);
			$this->handleTimeout(++$start);
		}

		if ($start <= 1) {
			Maintenance::$tool->logProgress(__LINE__, true);
			$table->populate();
			Maintenance::$tool->logProgress(__LINE__, true);
			$this->handleTimeout(++$start);
		}

		if ($start <= 2) {
			Maintenance::$tool->logProgress(__LINE__, true);
			// Add an order value to each existing cust profile field.
			$ocf = $this->query(
				'SELECT id_field
				FROM {db_prefix}custom_fields
				WHERE field_order = 0',
			);

			// We start counting from 5 because we already have the first 5 fields.
			$fields_count = 5;

			Maintenance::$tool->logProgress(__LINE__, true);
			while ($row = Db::$db->fetch_assoc($ocf)) {
				++$fields_count;

				Maintenance::$tool->logProgress($row['id_field'], true);
				$this->query(
					'UPDATE {db_prefix}custom_fields
					SET field_order = {int:field_count}
					WHERE id_field = {int:id_field}',
					[
						'field_count' => $fields_count,
						'id_field' => $row['id_field'],
					],
				);
			}
			Db::$db->free_result($ocf);

			Maintenance::$tool->logProgress(__LINE__, true);
			$this->handleTimeout(++$start);
		}

		return true;
	}
}

Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Fixes error when upgrading from SMF 2.0

Signed-off-by: Jon Stovell <jonstovell@gmail.com>
@sbulen
Copy link
Contributor

sbulen commented Mar 21, 2026

Hm. Does the admin_info_files table not exist in the database before the upgrade starts?

Yes, the table exists, & the prefix is specified in Settings.php. It's a simple 2.1 install. I suspect the problem here, though, is that somehow the prefix was lost...

It's not "admin_info_files", it's "smf_admin_info_files".

@Sesquipedalian
Copy link
Member Author

Ah, yes. That would likely explain it. I'll take a look when I have time later.

@sbulen
Copy link
Contributor

sbulen commented Mar 21, 2026

MariaDB 2.1 => 3.0:

Refreshed the code, implemented your tweak above & reattempted the upgrade. It actually got much further...

image

php/apache/mysql logs: Nothing

upgrader log (bottom):

+++ Parsing board descriptions and names... skipped.
+++ Add backtrace to log_error... skipped.
+++ Update permissions system board_permissions_view... done.
+++ Correct schema diff... skipped.
+++ Update holidays... done.
+++ Fix mods columns... done.
+++ Ensuring "smf_admin_info_files" is structured correctly... done.
+++ Ensuring "smf_approval_queue" is structured correctly... done.
+++ Ensuring "smf_attachments" is structured correctly... done.
+++ Ensuring "smf_background_tasks" is structured correctly... done.
+++ Ensuring "smf_ban_groups" is structured correctly...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants