Welcome to the Koken CMS community!

Here at KCS, you will find a friendly bunch of photographers who like to share their love for the Koken CMS. We hope that you will enjoy your time here and thrive in our community!

You asked for it: Donations!
You asked for it, and it's here: The possibility to "buy me a beer (or more)"!

Seriously: By giving a small paypal donation you will help with keeping this site afloat and also give me more incentive to develop OxyGen further... ;)

// Bjarne Varöystrand and the KCS Team
Koken Development

[OBSOLETE] PHP script to pre-cache all your images

Not plugins, but still Koken related tools & scripts
User avatar
eax
Contributor
Contributor
Posts: 7
Joined: Fri 15 May 2015, 19:51

[OBSOLETE] PHP script to pre-cache all your images

Postby eax » Mon 25 May 2015, 19:21

Hi!

I’ve made a script to warmup the Koken image cache. You can find it here : https://github.com/sylvaindeloux/koken-cache-warmup

It’s a simple script with a basic workflow :
- lists all your images from the database
- generates all formats URLs for each image
- call the image with the public URL so Koken engine can do its job

It’s a PHP script using cURL. No Koken internal source code is used (will be compatible with the next Koken releases).

Sylvain
User avatar
Bjarne Varöystrand
Webbplatsadministratör
Webbplatsadministratör
Posts: 1063
Joined: Sun 29 Mar 2015, 21:02
Your name: Bjarne Varöystrand
Location: Lysekil, Sweden
Contact:

Re: PHP script to pre-cache all your images

Postby Bjarne Varöystrand » Mon 25 May 2015, 19:32

Looking good!

Will give it a try tomorrow... :)

Thanks for your work: and that your sharing with us! :)
Regards
Bjarne Varöystrand - Image || Reddit || Twitter|| Facebook

Image
User avatar
Bjarne Varöystrand
Webbplatsadministratör
Webbplatsadministratör
Posts: 1063
Joined: Sun 29 Mar 2015, 21:02
Your name: Bjarne Varöystrand
Location: Lysekil, Sweden
Contact:

Warm-up cache script

Postby Bjarne Varöystrand » Wed 27 May 2015, 13:10

Moved it here
Regards
Bjarne Varöystrand - Image || Reddit || Twitter|| Facebook

Image
mklein
User
User
Posts: 18
Joined: Wed 27 May 2015, 20:59

Re: Warm-up cache script

Postby mklein » Wed 27 May 2015, 21:02

Hi Bjarne,

How can I use this script? I only have webspace on a hosted system and no acces to the console.

BTW: Thanks a lot for hosting this forum here and your support to the Koken community. I really appreciate it.

Regards,
Michael
User avatar
Bjarne Varöystrand
Webbplatsadministratör
Webbplatsadministratör
Posts: 1063
Joined: Sun 29 Mar 2015, 21:02
Your name: Bjarne Varöystrand
Location: Lysekil, Sweden
Contact:

Re: Warm-up cache script

Postby Bjarne Varöystrand » Thu 28 May 2015, 01:08

Hi Michael.
Thank you for your warm words :D

You will have to wait for eax to make this script "for the rest of us"...

If your more "die-hard" then me: you could try to execute it via cURL or any other commandline tool.
Regards
Bjarne Varöystrand - Image || Reddit || Twitter|| Facebook

Image
User avatar
eax
Contributor
Contributor
Posts: 7
Joined: Fri 15 May 2015, 19:51

Re: Warm-up cache script

Postby eax » Thu 28 May 2015, 08:32

This script need a console access to be executed. But it can be forked to add remote curl call :)
repiuk
User
User
Posts: 37
Joined: Sun 14 Jun 2015, 13:23
Location: NL
Contact:

Re: Warm-up cache script

Postby repiuk » Tue 16 Jun 2015, 20:25

I'm not the best PHP coder. If I run this from the koken root folder it drops an error at line 45
Since it runs this far I must assume the script did find the database.php file
Running the script on OSX.

PHP Notice: Undefined variable: KOKEN_DATABASE in /Library/Server/Web/Data/Sites/koken/cache-warmup.php on line 45
PHP Notice: Undefined variable: KOKEN_DATABASE in /Library/Server/Web/Data/Sites/koken/cache-warmup.php on line 45
PHP Notice: Undefined variable: KOKEN_DATABASE in /Library/Server/Web/Data/Sites/koken/cache-warmup.php on line 45
PHP Notice: Undefined variable: KOKEN_DATABASE in /Library/Server/Web/Data/Sites/koken/cache-warmup.php on line 45
ERROR: Unable to access database (SQLSTATE[HY000] [1045] Access denied for user ''@'localhost' (using password: NO)).
User avatar
Bjarne Varöystrand
Webbplatsadministratör
Webbplatsadministratör
Posts: 1063
Joined: Sun 29 Mar 2015, 21:02
Your name: Bjarne Varöystrand
Location: Lysekil, Sweden
Contact:

Re: Warm-up cache script

Postby Bjarne Varöystrand » Tue 16 Jun 2015, 22:05

Just looked at your site again, your I.php is in the root not in /koken/

Or am I missing something?
Regards
Bjarne Varöystrand - Image || Reddit || Twitter|| Facebook

Image
repiuk
User
User
Posts: 37
Joined: Sun 14 Jun 2015, 13:23
Location: NL
Contact:

Re: Warm-up cache script

Postby repiuk » Tue 16 Jun 2015, 22:23

Yes i.php is in the root. The script is also in root.
It runs on your install? Undefined variable suggest something is wrong
User avatar
Bjarne Varöystrand
Webbplatsadministratör
Webbplatsadministratör
Posts: 1063
Joined: Sun 29 Mar 2015, 21:02
Your name: Bjarne Varöystrand
Location: Lysekil, Sweden
Contact:

Re: Warm-up cache script

Postby Bjarne Varöystrand » Wed 17 Jun 2015, 15:13

I haven't had time to test it locally since I don't have shell access to my host... :/
Regards
Bjarne Varöystrand - Image || Reddit || Twitter|| Facebook

Image
User avatar
Bjarne Varöystrand
Webbplatsadministratör
Webbplatsadministratör
Posts: 1063
Joined: Sun 29 Mar 2015, 21:02
Your name: Bjarne Varöystrand
Location: Lysekil, Sweden
Contact:

Re: Warm-up cache script

Postby Bjarne Varöystrand » Wed 17 Jun 2015, 22:12

repiuk wrote:Yes i.php is in the root. The script is also in root.
It runs on your install? Undefined variable suggest something is wrong

File a bug report to eax here to get his attention...
Regards
Bjarne Varöystrand - Image || Reddit || Twitter|| Facebook

Image
repiuk
User
User
Posts: 37
Joined: Sun 14 Jun 2015, 13:23
Location: NL
Contact:

Re: Warm-up cache script

Postby repiuk » Fri 19 Jun 2015, 14:14

before the line

Code: Select all

require($databaseConfigFile);

Paste and edit the code below:
--------

Code: Select all

$KOKEN_DATABASE = Array(
      'driver' => 'mysqli',
      'hostname' => 'localhost',
      'database' => 'Koken',
      'username' => 'your_database_account',
      'password' => 'your_database_password',
      'prefix' => 'koken_',
      'socket' => ''
   );
Carsten
User
User
Posts: 5
Joined: Wed 09 Sep 2015, 20:31
Your name: Carsten

Re: Warm-up cache script

Postby Carsten » Wed 09 Sep 2015, 20:49

Hi guys,
first let me express, fine to have this forum as currently there is no more support on the official Koken site and second, wonderful that there are folks contributing to improve Koken.
So I've tried this script, too, without success, no matter with or without the Koken db credentials, it runs on failure. Unfortunately I don't have any clue what's the problem, as on severals tries it stops each time at a different line with the message "the command can't be executed".

@eax
Any chance you check and maybe have a debug option which gives detailed response on the failure cause?

Thanks and reagrds,
Carsten
User avatar
Bjarne Varöystrand
Webbplatsadministratör
Webbplatsadministratör
Posts: 1063
Joined: Sun 29 Mar 2015, 21:02
Your name: Bjarne Varöystrand
Location: Lysekil, Sweden
Contact:

Re: Warm-up cache script

Postby Bjarne Varöystrand » Wed 09 Sep 2015, 21:49

Thank you @Carsten :)
We are doing our best to keep things "floating": at least here ;)
But I do try to visit help.koken.me on a "regular basis" to provide at least some support there to :D

I have sent Sylvain a "nudge" on GitHub to: hopefully he will get to us as soon as he can. :)
Regards
Bjarne Varöystrand - Image || Reddit || Twitter|| Facebook

Image
User avatar
Jack
User
User
Posts: 15
Joined: Sat 26 Sep 2015, 13:14
Your name: Jack

Re: PHP script to pre-cache all your images

Postby Jack » Sat 26 Sep 2015, 15:02

eax wrote:Hi!

I’ve made a script to warmup the Koken image cache. You can find it here : https://github.com/sylvaindeloux/koken-cache-warmup

It’s a simple script with a basic workflow :
- lists all your images from the database
- generates all formats URLs for each image
- call the image with the public URL so Koken engine can do its job

It’s a PHP script using cURL. No Koken internal source code is used (will be compatible with the next Koken releases).

Sylvain



I am not quite sure what the purpose of this script is to the average user?

When you clear the cache in Koken via the Admin controls panels does it not start to generate a new set of cached images there and then?
User avatar
Bjarne Varöystrand
Webbplatsadministratör
Webbplatsadministratör
Posts: 1063
Joined: Sun 29 Mar 2015, 21:02
Your name: Bjarne Varöystrand
Location: Lysekil, Sweden
Contact:

Re: PHP script to pre-cache all your images

Postby Bjarne Varöystrand » Sat 26 Sep 2015, 15:56

Jack wrote:I am not quite sure what the purpose of this script is to the average user?
Since this script requires that you have console access to your server, its not for the average user... :(
Jack wrote:When you clear the cache in Koken via the Admin controls panels does it not start to generate a new set of cached images there and then?
The images is not created per auto, every preset is created when it is called for: not before...
This means that when you upload a new image to a album, the thumbnail on your public side wont be created before anyone visits the album it self: same goes for the rest of the presets.

Thats why this script was created, to force the creation of the different presets: and that way speed up things for the visitors...
Regards
Bjarne Varöystrand - Image || Reddit || Twitter|| Facebook

Image
User avatar
Jack
User
User
Posts: 15
Joined: Sat 26 Sep 2015, 13:14
Your name: Jack

Re: PHP script to pre-cache all your images

Postby Jack » Sat 26 Sep 2015, 16:56

Bjarne Varöystrand wrote:
Jack wrote:I am not quite sure what the purpose of this script is to the average user?
Since this script requires that you have console access to your server, its not for the average user... :(
Jack wrote:When you clear the cache in Koken via the Admin controls panels does it not start to generate a new set of cached images there and then?
The images is not created per auto, every preset is created when it is called for: not before...
This means that when you upload a new image to a album, the thumbnail on your public side wont be created before anyone visits the album it self: same goes for the rest of the presets.

Thats why this script was created, to force the creation of the different presets: and that way speed up things for the visitors...


I thought photos were re-cached as soon as yo clear the cache because I noticed via FTP the Cache folder empties itself and then starts to repopulate itself with new files
User avatar
Bjarne Varöystrand
Webbplatsadministratör
Webbplatsadministratör
Posts: 1063
Joined: Sun 29 Mar 2015, 21:02
Your name: Bjarne Varöystrand
Location: Lysekil, Sweden
Contact:

Re: Warm-up cache script

Postby Bjarne Varöystrand » Sat 26 Sep 2015, 18:07

It only repopulate when some one is accessing your site
Regards
Bjarne Varöystrand - Image || Reddit || Twitter|| Facebook

Image
User avatar
Bjarne Varöystrand
Webbplatsadministratör
Webbplatsadministratör
Posts: 1063
Joined: Sun 29 Mar 2015, 21:02
Your name: Bjarne Varöystrand
Location: Lysekil, Sweden
Contact:

Re: Warm-up cache script

Postby Bjarne Varöystrand » Sun 04 Oct 2015, 23:22

It has come to my attention that this original script is not working as it should...

A modified version found here is said to work:
https://gist.github.com/georg90/dc60b9f39ddb3e76010d

I'm unfortunately not able to verify this, so if you try this: please report back with your "mileage" :)
Regards
Bjarne Varöystrand - Image || Reddit || Twitter|| Facebook

Image
georg90
Developer
Developer
Posts: 11
Joined: Wed 14 Oct 2015, 10:20
Your name: Georg

Re: Warm-up cache script

Postby georg90 » Wed 14 Oct 2015, 10:30

wow, I just wanted to post my solution here, but you were a lot faster!
So the internet is a small place after all :)

My modified script is working here without any issues.
I also updated it a little, so it only runs once while called via cron.

Keep up the great work!

  • Similar Topics
    Replies
    Views
    Last post

Return to “Scripts”



Who is online

Users browsing this forum: No registered users and 1 guest