Jump to content

Upgrade: SQL Syntax error


Go to solution Solved by Stuart Silvester,

Recommended Posts

Posted

Can I trick it modifying that file AFTER it checks somehow?

 

Downgrading from current ubuntu LTS 20.04 version would be a whole new project for me. Never done such a downgrade. But I am a software engineer with 30 years of programming experience.

 

Posted

This should work.

Edit applications/core/setup/upg_32000/upgrade.php line 1116 and change it to

\IPS\Db::i()->query( "UPDATE `" . \IPS\Db::i()->prefix . 'groups` SET `g_view_board`=1 WHERE `g_id`=' . (int) $INFO['guest_group'] );

You would need to disable the upgrade file check with:

\define( 'UPGRADE_MD5_CHECK', FALSE );

In your constants.php file.

Make sure you remove this after the upgrade.

Posted
3 minutes ago, dutchsnowden said:

Can I trick it modifying that file AFTER it checks somehow?

[...]

 

Overwrite the modified file after initial check? Probably all scrips are re-checking? And maybe there are other places where new syntax is used?

Just now, Stuart Silvester said:

This should work.

Edit applications/core/setup/upg_32000/upgrade.php line 1116 and change it to

\IPS\Db::i()->query( "UPDATE `" . \IPS\Db::i()->prefix . 'groups` SET `g_view_board`=1 WHERE `g_id`=' . (int) $INFO['guest_group'] );

You would need to disable the upgrade file check with:

\define( 'UPGRADE_MD5_CHECK', FALSE );

In your constants.php file.

Make sure you remove this after the upgrade.

Lemme try this.

1 minute ago, Stuart Silvester said:

This should work.

Edit applications/core/setup/upg_32000/upgrade.php line 1116 and change it to

\IPS\Db::i()->query( "UPDATE `" . \IPS\Db::i()->prefix . 'groups` SET `g_view_board`=1 WHERE `g_id`=' . (int) $INFO['guest_group'] );

You would need to disable the upgrade file check with:

\define( 'UPGRADE_MD5_CHECK', FALSE );

In your constants.php file.

Make sure you remove this after the upgrade.

Cannot locate constants.php, can you lend me a hand with it's location?

 

romulusm@Selenium:~$ grep -r 'UPGRADE_MD5_CHECK' .
./ips_702f7/applications/core/modules/setup/upgrade/systemcheck.php:    if ( \IPS\UPGRADE_MD5_CHECK )
./ips_702f7/init.php:                           'UPGRADE_MD5_CHECK'     => TRUE, // Can be used to prevent the upgrader checking that the files that are present are correct
romulusm@Selenium:~$

 

Posted (edited)

Seems it escaped wrongly the "bb_groups" too? (line 1117 is because I commented out original line and replaced with new on next line)

image.png.039246d4696a792d22ec1af9e975331e.png

groups is escaped correctly but now bb_groups table name before it seems wrong.

 

Edited by dutchsnowden
Posted
2 minutes ago, dutchsnowden said:

Seems it escaped wrongly the "bb_groups" too? (line 1117 is because I commented out original line and replaced with new on next line)

image.png.039246d4696a792d22ec1af9e975331e.png

groups is escaped correctly but now bb_groups before it seems wrong.

 

Revert your changes to upgrade.php and then change line 1116 to the query I have posted here: https://invisioncommunity.com/forums/topic/464771-upgrade-sql-syntax-error/?do=findComment&comment=2876454

 

Posted

Trying now but it will take 16 mins for each try as I need to restore database at the point after UTF8 conversion.

UTF8 conversion takes 1h 30m. Restoring it takes 16m. So after each error, I restore database to make sure I try on fresh.

 

Posted (edited)

I guess same exact error at line in 32001 line 40 now. "groups" not escaped.

 

image.png.1561bea96ca515f608fcd209713cdf9c.png

1064You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'groups SET g_photo_max_vars=REPLACE(g_photo_max_vars, ':150:150', ':200:300') W' at line 1
/var/www/html/forums/applications/core/setup/upg_32001/upgrade.php::40
UPDATE `bb_groups` groups  SET g_photo_max_vars=REPLACE(g_photo_max_vars, ':150:150', ':200:300') WHERE g_photo_max_vars LIKE '%:150:150' 

 

\IPS\Db::i()->update( 'groups', "g_photo_max_vars=REPLACE(g_photo_max_vars, ':150:150', ':200:300')", "g_photo_max_vars LIKE '%:150:150'" );

 

Edited by dutchsnowden
Posted

So, I've come to a conclusion and succeeded first dry-run. Friendly URLs not working, redirects not working, and missing uploads files, but database is sane and working.

Not sure how to solve this one:

image.thumb.png.731d734b6135b136c10e61c9ed4c3842.png

What I did was upgrade pure database only to 3.4 version (everything except calendar).

Then from 3.4 version to 4.6.9 all worked smoothly (including calendar and pages).

So for now I tricked the upgrade and managed to convert everything to 4.6.9. Any ideas how to solve the template error above?

 

Posted
Just now, dutchsnowden said:

So, I've come to a conclusion and succeeded first dry-run. Friendly URLs not working, redirects not working, and missing uploads files, but database is sane and working.

Not sure how to solve this one:

image.thumb.png.731d734b6135b136c10e61c9ed4c3842.png

What I did was upgrade pure database only to 3.4 version (everything except calendar).

Then from 3.4 version to 4.6.9 all worked smoothly (including calendar and pages).

So for now I tricked the upgrade and managed to convert everything to 4.6.9. Any ideas how to solve the template error above?

 

Have you tried logging into the Admin CP, clicking the support link in the upper right hand corner and then clearing the system cache?  (Middle right of the page)

Posted

Admin Dashboard works correctly it seems.

 

image.png

Just now, Randy Calvert said:

Have you tried logging into the Admin CP, clicking the support link in the upper right hand corner and then clearing the system cache?  (Middle right of the page)

Clearing system cash? Guide me. I am new to this 4.6.9.

 

This one?

 

image.png.06cb8b0f455e4316357e9ea2e23fad6a.png

It does not help clearing system caches.

 

Posted
9 minutes ago, Stuart Silvester said:

I have submitted a potential fix for the upgrade SQL issues when upgrading from < 4.0.0 using MySQL 8.0.2 or newer. Following review and approval this change should be included in an upcoming release.

To be honest, your solution was awesome, and thank you for it, but who knows how many lines should have been changed because of that escaping or however it is called. We corrected one, I stumbled upon the second, but there may be tens afterwards.

 

Posted
4 minutes ago, dutchsnowden said:

To be honest, your solution was awesome, and thank you for it, but who knows how many lines should have been changed because of that escaping or however it is called. We corrected one, I stumbled upon the second, but there may be tens afterwards.

 

Yes, it wasn't a good enough workaround. I went a different route for the fix I have committed.

Posted
46 minutes ago, dutchsnowden said:

I am close to finish upgrade to 3.4 on production server then start with 4.6.9

Sorry but I am so stressed out and so much sleep missing that I needed to share this here.

 

image.thumb.png.eb85e067f6fc840ff1203b804e392342.png

High Five Teamwork GIF by SpongeBob SquarePants

Nice! Glad to see this progressing for you.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...