Page 1 of 1
Updating code question
Posted: Sun Dec 07, 2025 5:40 am
by nealk
I'm currently running a modified version of 1.7 with sqlite3.
The modifications are for caching, harden a few files, and restricting the login access to use MFA.
(It's worked great for years.)
Unfortunately, the old version doesn't work with php8.
How hard is it to upgrade from 1.7 to 2.5?
Are the upgrade steps documented somewhere? (No offense, but s9y has lots of documentation but isn't easy to search.)
Can I use my same custom template and sqlite DB? (With over 1000 blog entries, I dread editing all of them to do an upgrade.)
Re: Updating code question
Posted: Mon Dec 08, 2025 12:44 pm
by onli
Good question!
You will likely run into issues with the PHP version incompatibilites. I described the upgrade path for PHP 8 in
https://github.com/s9y/Serendipity/wiki ... h-to-PHP-8. The idea: Stick to PHP 7, upgrade to at least Serendipity 2.4 (for PHP 8.0), better 2.5 (for PHP 8.2) or 2.6-beta1 (for PHP 8.4), then switch to the new PHP version.
This was tested with a starting point of Serendipity 2.3.5 with PHP 7.4, so I would upgrade to those versions first if you still have PHP 7.4 available.
nealk wrote: Sun Dec 07, 2025 5:40 amAre the upgrade steps documented somewhere?
The specific changes the upgrader does are to my knowledge not documented. They are reasonable readable in code and include the description the upgrader would show at
https://github.com/s9y/Serendipity/blob ... c.php#L184.
nealk wrote: Sun Dec 07, 2025 5:40 amCan I use my same custom template...
Likely, but Smarty complained a lot about regular syntax when we upgraded to PHP 8 (undefined variables etc). I gathered from their changelog that this improved in newer Smarty version, which 2.6-beta1 for example does include. So probably best to aim for the highest Serendipity version you can. Also, in production mode (how logging works on stable and beta s9y version) many of those warnings should be silenced, so the old template might work just fine (back then the logic of those reporting modes was broken and thus very loud).
nealk wrote: Sun Dec 07, 2025 5:40 amCan I use my same ... sqlite DB?
I think I use use the same sqlite DB for longer (1.5?) and had no issues.
Maybe you can do a copy of your blog on a subdomain or different server and test the update with the copy first? That would be my recommendation.
Re: Updating code question
Posted: Mon Dec 08, 2025 12:48 pm
by onli
PS: I have a PR open for MFA via an email code,
https://github.com/s9y/Serendipity/pull/941. If you had your own implementation, maybe you can give feedback? I assume you also had to change the login logic in include/functions_config.inc.php?
Re: Updating code question
Posted: Wed Dec 24, 2025 5:54 am
by nealk
My main customizations:
1. The login page is hidden, and won't accept login attempts, unless you come from the correct networks. (2FA: Something you know, and somewhere you are.) Also restricted the search engine by IP address because Google would continually submit junk queries in order to index every possible response.
2. I added caching for the pages. The DB lookup (even SQLite) is slow and resource intensive. I'd get hit by high-volume crawling bots and it would be like a DoS.
3. Added anti-bot code. If the page doesn't exist, then block the bot. Too many crawlers trying to walk every link, even links that don't exist.
Re: Updating code question
Posted: Wed Dec 24, 2025 5:57 am
by nealk
For the upgrade path: If the DB is mostly the same, then I might try to install from scratch, port my templates, and then just copy my entries+comments from one DB to the other. Doing the step-wise update seems fragile and error-prone.
If you have any suggestions about what Sqlite3 DB columns can be directly copied, that would be a huge help.
Re: Updating code question
Posted: Wed Dec 24, 2025 9:45 am
by onli
I would copy the whole sqlite file. Values for httppath and local path (there I'd need to check the name, serendipityPath?) can be changed if needed in serendipity_config.