Upgrading existing integrated site to mysqli AND SMF 1 to SMF 2

Started by kaiya, February 12, 2021, 01:38:11 PM

Previous topic - Next topic

kaiya

Apologies for long post - the code is so old and I even had to revise how to write IF statements to start editing it, which given I wrote the original by hand on Notepad (not even Notepad ++) is embarrassing. Also I may be slightly perverse but I am finding this incredibly fun so can't stop talking about it - problem solving ftw. Luckily I was apparently the queen of commenting. So, back in 2009 I set up the following:

CURRENT SETUP

  • Server now running 5.4 (manually rolled back to keep my site functioning)
  • Site written in PHP 4 and mysql at oldsite.co.uk/ [nofollow] - the site really only uses smf_members though it has a load of tables itself for the features it delivers (imagine a very simple but sprawling handmade CMS tailored to deliver very specific services - lots of pages but mostly simple queries, update, upload images, delete, edit - all the simple stuff. Just lots of it.
  • SMF 1.1.21 forums at oldsite.co.uk/forums [nofollow] - few mods but mostly spambot catchers that don't catch spambots any more. Also smf_members has a few extra columns added (added before this was a feature SMF could do.
  • Single login works for both areas, SSI.php lives in /forums.
  • Site and forum tables all in one database.

Astonishingly it has run without major issues for over 12 years. However my hosting company has informed me that at the end of this month (starting 10 days from now) the server will upgrade to PHP 7.4 so I have to finally get off my butt and upgrade it. Skills-wise I am entirely self taught, I can't get my head around object oriented at all so just procedural. I have a 'dev environment' which is basically a second hosting account with the same provider (Hostgator if it matters) that is already running PHP 7.4.

PLAN

  • Upgrade PHP 4 to PHP 7 and mysql to mysqli (which so far seems to be a case of adding the letter i to things... *watches more clever coders die a little inside as I say this*)
  • Upgrade the forums to SMF 2 as bots are overtaking our life and I'm hoping that'll deal with that issue better. Plus security etc.

WHAT I DID (on my holidays - literally, I was off this week)

  • Exported the SMF tables and site tables and imported them to dev server
  • Downloaded the SMF files from oldsite/forums and initially uploaded them to newsite/
  • Repaired settings to get it working and upgraded to SMF 2.0.17 via the upgrade.php file iirc. Upgraded later to 2.0.18 using a patch.
  • Failed to get the site working in a sub-directory (I thought this might be neater)
  • Put the site into the root directory - got it working.
  • Had an argument with local vs global cookies that locked me out of the forum and site and almost rage quit but fixed it by turning off global cookies via PHPMyAdmin.
  • Moved the SMF files in newsite/ to newsite/forums to see if I can duplicate the structure on the oldsite as that would be so much easier when we need to upgrade
  • (we are here) struggling to get the site to work in newsite/ with SMF in newsite/forums.

ISSUES AND SOLUTIONS (including both in case anyone else is engaging in such madness).

  • Some SMF 2.0 columns have been changed from camelcase to lowercase with hyphens. e.g. realName in smf_members is now real_name. This is fine. Notepad ++ can do find and replace in all open files at once.
  • Mysqli _connect is slightly different but easy enough to copy over the new code I've learned and add i's to things. I'm sure I'm doing sloppy code as I don't add the free results thing as never sure where to add it and my pages tend to need multiple queries running nested or joined or whatever. Long term I'll do a proper revamp, today's project is 'survive upgrade to 7.4'. Any depreciated functions no doubt I'll find and replace on my travels.
  • SSI.php - this is the problem. I think.

Issue 3 in more depth. On my old site I have SSI.php in a subdirectory (/forums) and the main site pages in public_html and no issues calling to it. I did have issues with banned members being able to access the site so is_banned etc. ran before SSI was called but I've removed that (solve that problem later) so now SSI.php is the top thing called. In my efforts this week I did get SMF 2 working with the site when they were both installed in public_html on the PHP 7.4 dev hosting but 1) the site has 140 files and 2) having to move the forums makes using my 'fixed' files straight off the bat harder work when I need to move all of this to the live site vs relative and absolute links etc. (it's a mish mash in there). I can do that if I have to, but is there an alternative?

I read elsewhere on this forum that integrated sites need now to live in the same directory as SMF 2. Is this correct? Clearly SMF 1 could run in a sub directory as I've been using it as such for 12 years... Really I just want to know: Is what I am wanting to achieve possible now?

If I've missed any details out in my rambling please ask. One issue with being self-taught is not knowing what is really important.

Kindred

SMF runs just fine in a subdirectory.

SSI.php *MUST* be in the same directory as Settings.php (aka, your forum root)

You can call require_once('path/to/SSI.php'); from other directories to insert SMF content into the page -- but SSI.php itself must be in the forum root.


The OTHER site content can be in any directory or subdirectory.

here's one of my site's config

site root -- homepage, contact us, sales info static pages [uses SSI to pull in latest post]
|  |
|  +--(/product) -- online store   [uses SSI to pull in some forum content]
|
+--------(/forum) -- SMF
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

kaiya


Advertisement: