Directory templates_c ...

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
Lux
Regular
Posts: 764
Joined: Fri Aug 12, 2005 4:36 pm
Location: Grüt, Zürich, Switzerland
Contact:

Directory templates_c ...

Post by Lux »

Hi,

can please anyone tell me, what the directory templates_c is for?

If I am right, it is for caching templates ;-)

One of our blogs has megabytes of data in it and I don't know, if I can delete the files safely.

Dirk

P.S.: Does any php-script exist to delete the data?
falk
Regular
Posts: 512
Joined: Tue Sep 27, 2005 10:16 am
Location: DD
Contact:

Re: Directory templates_c ...

Post by falk »

Hello Lux (Dirk).
Lux wrote:If I am right, it is for caching templates ;-)
That's right (irgendwie :-)). These are 'compiled' pages with php-code. Take a look and you know i am writing.
Lux wrote:One of our blogs has megabytes of data in it and I don't know, if I can delete the files safely.
I delete the files from time to time and i have no problem. But if you call the website the next time, the cache will be rebuild. (If you have a plain installatian the templates_c is empty, so you must not have a problem to delete this files.)
Lux wrote:P.S.: Does any php-script exist to delete the data?
I think: no. You must write your own script.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Directory templates_c ...

Post by garvinhicking »

Added to what Falk absolutely correctly pointed out:

Smarty purges old cache files on its own every now and then, so you basically don't need to delete the data of the script anyhow.

If you switch templates a lot, though, for each template caches will be built. You can then delete the cache-files for all the templates you are not longer going to offer on your blog.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Lux
Regular
Posts: 764
Joined: Fri Aug 12, 2005 4:36 pm
Location: Grüt, Zürich, Switzerland
Contact:

Post by Lux »

Hi,

thanks for your advices.

My problem is, I can not delete files, created by php.

The setting is the following: I have a ftp account, to upload and to download data, name it ftpuser. On the site works an apache webserver with userid apacheuser.

Sure, I can delete all files owned by ftpuser, but to delete any files owned (or created) by apacheuser, I have to contact the site support.

What I need is a script which changes ownership of files or alternatively deletes all files owned by apacheuser.

Do you see the point?

Dirk
falk
Regular
Posts: 512
Joined: Tue Sep 27, 2005 10:16 am
Location: DD
Contact:

Post by falk »

Hello Dirk!
Lux wrote:My problem is, I can not delete files, created by php.
If you search for chmod in this forum, you have 136 hits. And you find a short code from garvin:

Code: Select all

<?php 
 chmod('serendipity_config_local.inc.php', 0777); 
 ?> 
This mean you must write your own script including this chmod, but (i hope i am right):

Code: Select all

<?php 
 chmod('templates_c/*', 0777); 
 ?> 
Call this Script in your Browser and now you may delete this files in templates_c. If this done, then delete this script. It's safer. ;-)

PS: or you look in the php-manual: http://www.php.net/manual/en/function.unlink.php
Lux
Regular
Posts: 764
Joined: Fri Aug 12, 2005 4:36 pm
Location: Grüt, Zürich, Switzerland
Contact:

Post by Lux »

falk wrote:Hello Dirk!

Code: Select all

<?php 
 chmod('templates_c/*', 0777); 
 ?> 
Call this Script in your Browser and now you may delete this files in templates_c. If this done, then delete this script. It's safer. ;-)
I get an error message, when executing the php (open_basedir restriction in effect. File is not within the allowed path(s)).

I asked the proivider to support me.

To give you an idea: about 15 thousand (!) files were occupying 75 MB (!) of disk space.

Now it is clean again.

Dirk[/code]
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Lux, did you have a listing of how the names of the files were called?

Did you maybe install the simplecache plugin?

About the open_basedir error: You need to put the PHP script into the s9y root directory so that it can properly access the "templates_c/" directory. Also not to not write "/templates_c/"!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Lux
Regular
Posts: 764
Joined: Fri Aug 12, 2005 4:36 pm
Location: Grüt, Zürich, Switzerland
Contact:

Post by Lux »

garvinhicking wrote:Lux, did you have a listing of how the names of the files were called?
Most of them started with wx...

That's unfortunately all I know.
garvinhicking wrote:Did you maybe install the simplecache plugin?
No!
garvinhicking wrote:About the open_basedir error: You need to put the PHP script into the s9y root directory so that it can properly access the "templates_c/" directory. Also not to not write "/templates_c/"!
Ok. I put it in the blog-subdir and it did not work, than I took the absolute path and it also did not work ...

Put the "clean cash"-butto onto the wishlist of Version 0.9 ;-)

Dirk
falk
Regular
Posts: 512
Joined: Tue Sep 27, 2005 10:16 am
Location: DD
Contact:

Post by falk »

Hello Dirk.
Lux wrote:Ok. I put it in the blog-subdir and it did not work, than I took the absolute path and it also did not work ...
Put this script in the dir you find the index.php from s9y and call this script (not index.php!) in your browser. Then open your ftp-program and delete all the files in template_c. (This files are normaly now read-, write- and executeable for user, group and world.) Have you done this and the files can't be deleted, you have a problem :-). Then you must read the PHP manual for unlink.

I hope you can PHP so you know what you do and what we write :?:
Lux
Regular
Posts: 764
Joined: Fri Aug 12, 2005 4:36 pm
Location: Grüt, Zürich, Switzerland
Contact:

Post by Lux »

falk wrote:Put this script in the dir you find the index.php from s9y and call this script (not index.php!) in your browser. Then open your ftp-program and delete all the files in template_c. (This files are normaly now read-, write- and executeable for user, group and world.) Have you done this and the files can't be deleted, you have a problem :-). Then you must read the PHP manual for unlink.

I hope you can PHP so you know what you do and what we write :?:
Yes. Sure.

I did it in the same way, but it did not work.

May it be possible, that some "weird" settings in php.ini are responsible for this?

Dirk
Post Reply