clear cache with a command line???????

clear cache with a command line???????

Thursday 18 December 2008 12:14:11 pm - 13 replies

Modified on Thursday 18 December 2008 12:16:03 pm by Lizeth Lorenzana

Author Message

David Suela

Friday 19 December 2008 1:23:55 am

Try php bin/php/ezcache.php --clear-all --purge in the ezpublish instalation directory.

xsto.info <el acceso a la información>
http://xsto.info
http://dominios.coop

Sébastien Antoniotti

Sunday 19 July 2009 4:37:24 am

Hi,

I'm using this command since a long time, but it seems that on new versions (4.x) image aliases are not cleared.

I'm obliged to clear all caches via the admin interface in order to delete the aliases.

Is there a way to clear them with a line command ?

eZ Publish Freelance
web : http://www.webaxis.fr

Heath

Sunday 19 July 2009 6:24:38 am

Hello Sébastien,

Try clearing cache by tag!

<b>Examples:</b>

cd /web/ez/doc;
./bin/php/ezcache.php --clear-tag=image
./bin/php/ezcache.php --clear-tag=image --purge

See the list of tags in the software [0]

Cheers,
Heath

[0] <i>http://pubsvn.ez.no/nextgen/trunk/kernel/classes/ezcache.php</i>

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

Sébastien Antoniotti

Sunday 19 July 2009 7:30:09 am

Hi !

Thanks for your reply, but the --clear-tag=image doesn't do the trick.

I follow this steps :

1) first load of my webpage, image are resized in 400x300 because of their alias declaration in image.ini
2) second load of my webpage, image are in cache
3) I edit the image.ini to change alias dimension from 400x300 to 420x300 by example
4) I purge the caches with ./bin/php/ezcache.php --clear-tag=image --purge
5) I reload the webpage : images are still in 400x300, my browser cache is disabled
6) I clear all caches via the backoffice
7) I reload the webpage : images are well in 420x300

So I think that ezcache.php doesn't do the trick...

eZ Publish Freelance
web : http://www.webaxis.fr

Heath

Sunday 19 July 2009 7:50:29 am

Hmm,

Well are you certain your current shell user has full permissions to remove these files (prolly).

I would read the related part of the kernel module php api [0]

If your clearing all cache it seems that that form post action would trigger this part [1] of the eZ Publish PHP API.

eZCache:clearAll [2]

Cheers,
Heath

[0] <i>http://pubsvn.ez.no/nextgen/trunk/kernel/setup/cache.php</i>
[1] <i>http://pubsvn.ez.no/nextgen/trunk/kernel/classes/ezcache.php</i>
[2] <i>http://pubsvn.ez.no/doxygen/trunk/html/classeZCache.html</i>
[3] <i>http://pubsvn.ez.no/doxygen/trunk/html/ezcache_8php-source.html</i>

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

Heath

Sunday 19 July 2009 8:08:48 am

Yet most people should not want to clear all cache so broadly, so often and look for a more granular approach.

In this situation as I think about the problem at hand. Problem: Change Image Alias Settings; Require clearing which caches?

I would suggest the following consider clearing: ini, template, image, content

Also make certain your settings are configured to clear the appropriate VarDir (I've seen this prevent clearing cache before).

Cheers,
Heath

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

Steven E. Bailey

Sunday 19 July 2009 10:05:45 am

@Sébastien

I'm fairly certain that the last time I was testing new image aliases a couple of months ago on a 4.03 release that I was clearing the image aliases from the command line - after, of course, being all confused that the image aliases were not being regenerated after I deleted the cache files from the file system.

I don't remember exactly what I was using but I believe I used both --clear-tag=image and --clear-id=image-alias

Actually, as an aside, what's the difference between a tag and an id anyway?

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

Sébastien Antoniotti

Sunday 19 July 2009 10:29:43 am

Thanks all for your help,

I have runned the ezcache.php script in root : same problem, image aliases are not deleted, both with ./bin/php/ezcache.php --clear-all --purge and ./bin/php/ezcache.php --clear-tag=image --purge

The VarDir directive is OK in site.ini...

PS : I just would like to use this command line purge when I'm in development in order to have not to wait the form post process of the "backoffice clear all caches" who's longer than the command line script.

eZ Publish Freelance
web : http://www.webaxis.fr

Heath

Sunday 19 July 2009 10:30:40 am

@ Steven E. Bailey

It seems --clear-tag groupings of ids in a general way.

While --clear-id seems specific way to clear specific cache directly.

@ Sébastien

Try this attempt at another possible example

 ./bin/php/ezcache.php --clear-tag=image --clear-id=imagealias --purge
# or
./bin/php/ezcache.php --clear-tag=image --clear-id=imagealias
Clearing image: Image alias
Clearing imagealias: Image alias

See the static list of tags and ids available, <i>http://pubsvn.ez.no/doxygen/trunk/html/ezcache_8php-source.html#l00058</i>

Cheers,
Heath

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

Sébastien Antoniotti

Sunday 19 July 2009 10:38:00 am

OK !

You're right, <b>./bin/php/ezcache.php --clear-tag=image --clear-id=imagealias</b> do the job !

Does it mean that there's no way to clear ALL caches without having to list all the tags in one command line ?

eZ Publish Freelance
web : http://www.webaxis.fr

Heath

Sunday 19 July 2009 10:48:58 am

Are you certain you have not tried this example,

./bin/php/ezcache.php --clear-id=imagealias --clear-all --purge

Also try these commands to learn more

./bin/php/ezcache.php --list-tags;

./bin/php/ezcache.php --list-ids;

./bin/php/ezcache.php --help;

You could create a simple shell wrapper script which provides a simple one program no agruments way to clear cache you need cleared on a regular basis via command line.

Cheers,
Heath

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

kracker (the)

The Doctor

Sunday 19 July 2009 11:05:58 am

I hate typing all those long paths all the time!

I make a symbolic link to the script in the ezpublish root directory.

cd /web/dev/ez;  ln -s bin/php/ezcache.php clr;

Cheers,
<i>//kracker</i>

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

Sébastien Antoniotti

Sunday 19 July 2009 11:49:18 am

I agree but is not it strange that --clear-all make less job than a --clear=image-tag ?

@kracker

Mee too, and personnaly I use a .bashrc alias ;)

eZ Publish Freelance
web : http://www.webaxis.fr

You must be logged in to post messages in this topic!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.