DEV Community

Fixes for Koken problems in 2020

Alistair Shepherd on September 17, 2020

Koken was a self-hosted Content Management System built for photographers, offering off-the-shelf features like Adobe Lightroom integration, EXIF h...
Collapse
 
michaelkirste1 profile image
Michael Kirste

Hey folks,
some time ago, I released a self-hosted alternative to Koken called PortfolioSiteLab. Over the time the product has matured and got much more features.
You can find the project at io200.com. There is a completely free version up to a certain number of photos/articles/pages and migration from Koken can be done automatically. Unlimited usage can be purchased for a one-time payment (no subscription). If you are interested, check it out ;-).
BR, Michael
Image description

Collapse
 
michaelkirste1 profile image
Michael Kirste

Thanks for this great article. I'm also running multiple koken installations and could fix all problems with php 7.4.
However, I decided to completely reprogram the frontend and backend version of Koken. If you are interested, take a look at my article: michaelkirste.de/artikel/koken-cms...
Alt CMS Backend

Collapse
 
accudio profile image
Alistair Shepherd • Edited

That looks really interesting! I know a few people have been looking to do that but haven't found the appetite to do so.
Is any of the Koken codebase left in your code or have you built an entirely new solution from scratch?
If you make it public at any point I'd be interested to take a look!

Collapse
 
michaelkirste1 profile image
Michael Kirste

Hi Alistair, thanks for your reply. I did a complete rewrite of the system. This approachs offers the best performance and the new systems does not depend on so many other libraries.

Thread Thread
 
accudio profile image
Alistair Shepherd

Don't sell yourself short then, market it as a new system!
Koken was great but has a lot of baggage and although dead, someone still has the trademarks so probably worth distancing yourself a bit.

Regardless, good luck with it and if you do make it public I'll definitely check it out.

Thread Thread
 
michaelkirste1 profile image
Michael Kirste

Hey guys,
I finally finished the new CMS system for managing photo portfolio websites called PortfolioSiteLab. There is even an automated script that migrates your Koken data.

If you are interested, check out: portfoliositelab.com

BR regards and have a great weekend

Thread Thread
 
michaelkirste1 profile image
Michael Kirste

Hey folks, over the last year I further worked on PortfolioSiteLab. Nearly all former Koken functionalities have been implemented and many more added. Furthermore, setting up the new system is much easier using an automatic install script which also migrates an existing Koken installation.

Collapse
 
clack69 profile image
Thomas Rauers

Thanks a lot, this was really helpful - encountered the login problem after upgrading from PHP 7.2 to 7.4. What I really got in the Chrome console was

Uncaught TypeError: Cannot read property 'store' of null
    at Object.finished (koken-core.js:1937)
    at koken-core.js:1251
Enter fullscreen mode Exit fullscreen mode

but your fix for /app/database/DB_Driver.php solved the login issue. Well, two more years of Koken until support for 7.4 runs out... ;-)

Collapse
 
accudio profile image
Alistair Shepherd

Glad to hear it!

It's worth looking for a replacement as soon as you can regardless of PHP, it's never a good idea to run a dead CMS without security updates!

Collapse
 
erniebee profile image
erniebee

Thank you for your help with Koken PHP issues. However, I am a bit of a beginner, so I have the following problem when trying to correct for the fact that my hosting service has just upgraded to PHP 7.4. I was able to downgrade to 7.2 so that everything works again, but 7.2 will no longer be available to me after November 30. So here is my problem:
When trying to implement your suggested fix i do the following

name_of_my_website.com/app/databas...

and i receive a 404 error.

Any ideas? Am I going about this in a wrong way?

Collapse
 
accudio profile image
Alistair Shepherd

Yes, you'll need to edit the actual files rather than visiting the pages.

Your hosting company will offer a file manager/FTP login and then in a folder probably called public_html or www you'll be able to find the files I refer to.

Be careful when editing these, any slight mistake might break your website but if you make the changes exactly how I say you'll be fine! :)

Collapse
 
erniebee profile image
erniebee

Hi Alistair,
Thanks for taking time to guide me in the right direction. Much appreciated, and it worked beautifully! I did, however, make a couple of observations in the process to implement this fix:
1) Contrary to your statement I found that PHP 7.3 actually worked fine without the fix, while 7.4 really needs it.
2) While my hosting provider also offers a beta version of PHP 8, I tried this both with and without the fix. Neither worked (I got the red Koken admin login window), so it seems this is going to be an ongoing problem as the PHP versions progress over time.
Thanks again,
Ernie

Thread Thread
 
accudio profile image
Alistair Shepherd

That's good to know, I migrated from PHP 7.2 to 7.4 and had assumed that 7.3 would also be an issue. Thanks, I'll update the article.

As for PHP 8, given there's a fair few breaking changes it will need more fixes as you say. Honestly I think given the timescale it will be before PHP 7.4 stops being available, it would be wise to have migrated away from Koken by then.
If it's easy for me to do so however I might see if I can come up with the fixes required in future.

Thread Thread
 
erniebee profile image
erniebee

OK, and as you say it's probably time to start looking for alternatives to Koken. However, finding something that does the job as well as Koken does for photographers, with Lightroom plug-in as well as being totally free, is going to be hard, I think.

Collapse
 
pirsch profile image
Pirsch

Hello Alistair,
thanks again for the fix. We run two installations of koken. One - the older one - is working again after the adjustments. The other one - however - which is a newer version of koken, does not work. While the site itself is serving files, the admin page says "Connection error. Cannot connect to the API." Might there be other adjustments to make?
Unfortunately, I don't know how to find out which built of koken it is.
Thank you
-Stephan

Collapse
 
accudio profile image
Alistair Shepherd

Hi Stephan,

This should be all that is required to make the newest version of Koken work with PHP 7.3/7.4. Keep in mind that more changes would be required for PHP 8 compatibility. I am undecided about diagnosing and releasing these though as it would be encouraging using Koken well beyond its lifespan—perhaps irresponsible security-wise.

It may be you have an older version that does require additional work, or there are plugins/modifications that would also need changes to work.

Regardless, for that second installation you are probably going to have to diagnose it yourself or have a developer do so for you. Koken is not a complex system and is not too hard to diagnose, but the lack of documentation does make it tricky.

Thanks,
Alistair

Collapse
 
pirsch profile image
Pirsch

Hi Alistair,
thanks for getting back. Yeah, it's really strange. Both installations run on PHP 7.3. I am asking myself if it is some kind of cache issue. Unfortunately, I can't access the server logfiles at this time, since I only have an ftp-account. You are certainly right in saying that one should rather not stick to Koken, but often - as in my case - there are customers that are reluctant to spending any more money on a website that just keeps serving static content and does not have to be touched anymore.
Thanks and all the best
Stephan

Collapse
 
cmahoney_photo profile image
𝙲𝚑𝚛𝚒𝚜 𝙼𝚊𝚑𝚘𝚗𝚎𝚢

First off, thanks for your hard work on this and for taking the time to post this. The only issue I have is that I would like to update jQuery due to the outdated version. I have tried some find/replace on all files, but ultimately it errors out when trying to load any images. Have you had any luck in doing this?

Collapse
 
accudio profile image
Alistair Shepherd • Edited

Hi, I'm afraid not - although it should be fairly straightforward I think.

Honestly though, I think trying to update jQuery is a waste of your time. Koken is dead, and it is very risky to continue using it.
I wrote this post to buy people more time to migrate.

Collapse
 
maxican profile image
rawimage

Thank you very much for this helpful article. Don't know if this is relevant, but I also had to clear the system cache in koken after updating i.php and shutter.php to fix the images-not-loading issue.

Collapse
 
accudio profile image
Alistair Shepherd

Thanks for mentioning! That's good to know - it wasn't required for me but I don't know Koken's image conversion system well so I perhaps got lucky.

Collapse
 
akhena profile image
André

Thank you a lot for this post Alistair!

I have been using Koken for more than 6 years and I have been failing miserably these last months in moving the koken install to a new server.

Thanks to the fix in DB_Driver.php mentionned in your post, I was finally able to have the admin console working on my new server (with php 7).

Big up for you Alistair!

Collapse
 
mohamedowsam profile image
Mohamed osam

Hello,
Thanks for sharing this knowledge, It's really helpful.
but I'm a bit confused as I have zero knowledge with coding should I write the new lines in the line no 1028 or should I replace it in 1018

Collapse
 
accudio profile image
Alistair Shepherd

Hi Mohamed,
Replace this line:

$args = (func_num_args() > 1) ? array_splice(func_get_args(), 1) : null;
Enter fullscreen mode Exit fullscreen mode

with this:

$func_args = func_get_args();
$args = (func_num_args() > 1) ? array_splice($func_args, 1) : null;
Enter fullscreen mode Exit fullscreen mode

Hope that helps!

Collapse
 
accudio profile image
Alistair Shepherd

I'm afraid I haven't heard of a php file you can use to reset but I assume it would be doing the exact process that I have listed just on the server rather than manually.

Are you making sure to include the internal_id in the URL of the api? You should visit a URL like "yourwebsite.com/api.php?/users/res...".

If you've got the internal_id and the url correct then you will have to diagnose the problem. As it's a 500 error it will appear in your hosting error log, which might help work out what the problem is.

I don't know if perhaps the reset password procedure has changed at some point, do you know if you are running the latest version of Koken? If it has changed I'm afraid I don't know the procedure you should be using.

Collapse
 
daedric7 profile image
daedric7

Thank you, with your fixes and some more tinkering i managed to get koken back running.

Yet, i'm facing a weird issue. Aparently some photos although being taken in portrait orientation, are stored in landscape proportions and with a exif tag (i think) to correct the orientation which most apps and websites respect, yet koken ignores.

No problem, i'll rotate the images. And in the admin the images are rotated and displayed correctly. But on the public website, they are distorced to the original proportions.

Am i alone in this experience ?

Collapse
 
accudio profile image
Alistair Shepherd

I'm afraid I haven't experienced that at all but I don't actually use Koken day-to-day, I have only developed for it.
I assume that Koken performs some manipulation then for either the website or admin that ignores EXIF orientation. You could maybe try a service that removes EXIF data and see if that succeeds?
Best of luck!

Collapse
 
pirsch profile image
Pirsch

Hey Alistair, thanks for your help and for keeping Koken alive!

Collapse
 
accudio profile image
Alistair Shepherd

Hi Pirsch, you're welcome.
Make no mistake though, Koken is very much dead. The intention of this post is not to help you keep your Koken site going longer - this is to help buy you a bit more time to migrate to a better solution.

Collapse
 
jonathanr79 profile image
Jonathan R • Edited

A big thanks! That did help me for the admin page but my site is still returning an error 500 :-(

Do you believe there is an easy way to upgrade jquery on Koken? It's quite old and may contain some security issues.

Regarding replacing a koken website. Did you look at Hugo, Gatsby and Next ?

Collapse
 
accudio profile image
Alistair Shepherd

There may be some further Koken issues other than I'm aware of. Unfortunately it's a bit tricky to diagnose, your best bet will be to take a look at the error log of your hosting and it should point you in the right direction.

Personally I don't think it's worth upgrading jQuery, although it will likely have security bugs - as it's a frontend-only dependency and Koken has limited interactivity I don't think that the risk is significant compared to using a CMS without security updates.

As for the SSGs you mention, good question! The alternatives I listed are mostly focused at Photographers rather than developers so are designed to be fairly easy to set up.
Personally as a developer I would be using an HTML-only Static Site Generator like 11ty, or Hugo (although I don't know Go so it's less accessible for me). I don't really like Gatsby as a technology or company (that's something I won't get into now) but if your website has lots of dynamic functionality and is more app-like than website-like then Next.js (w/ Preact), Nuxt or Sapper would do a great job.
Of course then it's a lot harder to manage content so I'd also probably pair it with a headless CMS like Sanity, Forestry, or my favourite - WordPress!