Simple Machines Community Forum

SMF Support => SMF 2.1.x Support => Topic started by: Marcelo Mika on November 23, 2014, 04:02:26 AM

Title: error in Step 4: Database Changes
Post by: Marcelo Mika on November 23, 2014, 04:02:26 AM
upgrading from 2.0.9 to 2.1 some errors.

2.0.9 installed clean to test the update.

The process stops : Step 4: Database Changes

Database Changes
Executing database changes


Please be patient - this may take some time on large forums. The time elapsed increments from the server to show progress is being made!
Executing upgrade script 2 of 2.
Executing: "Membergroup icons changes" (16 of 40 - of this script)




Error!
Server has not responded for 30 seconds. It may be worth waiting a little longer or otherwise please click here to try this step again


I click here, retries unsuccessfully and it is impossible to continue ..
Title: Re: error in Step 4: Database Changes
Post by: margarett on November 23, 2014, 10:11:26 AM
http://www.simplemachines.org/community/index.php?topic=530273.0

Probably your server fails to withstand the beating the upgrader imposes him :P

Who is your host?
Title: Re: error in Step 4: Database Changes
Post by: Marcelo Mika on November 23, 2014, 03:17:57 PM
Grazie mille !

Hostingmontevideo.com

a hosting which you no longer use.
He has been limited so far.
Unlimited plan ever worked with smf and 20,000 members, now you install a test site and hit the limit with one connection ...
Title: Re: error in Step 4: Database Changes
Post by: margarett on November 23, 2014, 03:23:03 PM
It's not the same thing... The upgrade process is a quite intense one... Several queries are thrown at the server, far more difficult to handle than the normal forum navigation...

Can you try it at localhost?
Title: Re: error in Step 4: Database Changes
Post by: lc62003 on November 23, 2014, 09:30:26 PM
I get the same error on a very small test site.  Taking the site out of maintenance mode manually gives this error: 

Table 'salvage.smf_moderator_groups' doesn't exist


Checking the database this is true, though there is a table smf_group_moderators



Are these items related?   8)
Title: Re: error in Step 4: Database Changes
Post by: Marcelo Mika on November 23, 2014, 10:58:03 PM
Yes, I also occurred to me that.
Title: Re: error in Step 4: Database Changes
Post by: Oldiesmann on November 24, 2014, 11:55:28 AM
The "smf_moderator_groups" table is a new table in 2.1. If it doesn't exist, that means the upgrader never completed properly.
Title: Re: error in Step 4: Database Changes
Post by: lc62003 on November 24, 2014, 12:23:41 PM
Quote from: Oldiesmann on November 24, 2014, 11:55:28 AM
The "smf_moderator_groups" table is a new table in 2.1. If it doesn't exist, that means the upgrader never completed properly.

Right.  Perhaps I should ask it a different way. 

Is there supposed to be a table named smf_moderator_groups and a table named smf_group_moderators?  Or is one of those misnamed in the script so it can't complete? 
Title: Re: error in Step 4: Database Changes
Post by: Arantor on November 24, 2014, 12:28:18 PM
There are supposed to be both tables, yes.
Title: Re: error in Step 4: Database Changes
Post by: lc62003 on November 24, 2014, 02:22:13 PM
Quote from: Arantor on November 24, 2014, 12:28:18 PM
There are supposed to be both tables, yes.

Roger that.  Thanks Arantor.   8) 
Title: Re: error in Step 4: Database Changes
Post by: lc62003 on November 26, 2014, 09:36:12 AM
The hangup is due to the script attempting to remove the "Core" theme.   The workaround is easy.  Edit the "upgrade_2-1_mysql.sql" file and remove the following:



/******************************************************************************/
--- Cleaning up after old themes...
/******************************************************************************/
---# Checking for "core" and removing it if necessary...
---{
// Do they have "core" installed?
if (file_exists($GLOBALS['boarddir'] . '/Themes/core'))
{
$core_dir = $GLOBALS['boarddir'] . '/Themes/core';
$theme_request = upgrade_query("
SELECT id_theme
FROM {$db_prefix}themes
WHERE variable = 'theme_dir'
AND value ='$core_dir'");

// Don't do anything if this theme is already uninstalled
if ($smcFunc['db_num_rows']($theme_request) == 1)
{
// Only one row, so no loop needed
$row = $smcFunc['db_fetch_array']($theme_request);
$id_theme = $row[0];
$smcFunc['db_free_result']($theme_request);

$known_themes = explode(', ', $modSettings['knownThemes']);

// Remove this value...
$known_themes = array_diff($known_themes, array($id_theme));

// Change back to a string...
$known_themes = implode(', ', $known_themes);

// Update the database
upgrade_query("
REPLACE INTO {$db_prefix}settings (variable, value)
VALUES ('knownThemes', '$known_themes')");

// Delete any info about this theme
upgrade_query("
DELETE FROM {$db_prefix}themes
WHERE id_theme = $id_theme");
}
}
---}
---#



  Barring other issues the script will run from beginning to completion.   8)  Hope this helps someone.   :D
Title: Re: error in Step 4: Database Changes
Post by: Illori on November 26, 2014, 09:53:13 AM
That is a database query not ftp action. Removing from ftp has no effect on getting that query run.
Title: Re: error in Step 4: Database Changes
Post by: lc62003 on November 26, 2014, 09:57:05 AM
Quote from: Illori on November 26, 2014, 09:53:13 AM
That is a database query not ftp action. Removing from ftp has no effect on getting that query run.

Corrected.  Thanks! 
Title: Re: error in Step 4: Database Changes
Post by: Kindred on November 26, 2014, 10:54:54 AM
ummm....  the first bit of that CHECKS for the core...
if (file_exists($GLOBALS['boarddir'] . '/Themes/core'))
if the core theme is there, it needs to be removed.
if the core theme is not there, this code should be ignored, because of the if statement...


what was the issue in your case? Why did you need to remove the check?

Title: Re: error in Step 4: Database Changes
Post by: Arantor on November 26, 2014, 11:02:54 AM
The reason is that this is buggy.

It's using db_fetch_array which doesn't exist. It should be db_fetch_row in this case.

Filed on GitHub.
Title: Re: error in Step 4: Database Changes
Post by: Kindred on November 26, 2014, 11:04:52 AM
ahy. good catch form the coder's eye.

Wonder why it never failed on our tests?
Title: Re: error in Step 4: Database Changes
Post by: Oldiesmann on November 26, 2014, 12:04:38 PM
Fixed on github now. I'm not sure why none of us ran into this issue either.
Title: Re: error in Step 4: Database Changes
Post by: lc62003 on November 26, 2014, 12:10:51 PM
Quote from: Arantor on November 26, 2014, 11:02:54 AM
The reason is that this is buggy.

It's using db_fetch_array which doesn't exist. It should be db_fetch_row in this case.

Filed on GitHub.

I'm no coder so I would never have gotten that.  Confirmed this works.   :)
Title: Re: error in Step 4: Database Changes
Post by: Paracelsus on December 01, 2014, 04:42:02 PM
Just to say that I've also stumbled on this error, went to upgrade_2-1_mysql.sql, edited db_fetch_array to db_fetch_row on the suggested code a few posts above and the rest worked nicely to the end.