Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

unable to delete compiled templates (shared webhosting ssh)

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
ZeroFill
Smarty Rookie


Joined: 31 Aug 2003
Posts: 28

PostPosted: Sat Jan 24, 2004 7:32 am    Post subject: unable to delete compiled templates (shared webhosting ssh) Reply with quote

is there a way to delete template_c files from ssh on a shared webhost? all the compiled files/dirs are owned by the apache (nobody) so i can't do an rm -rf *. (other than creating an instance of smarty, setting the tpl dir, executing clear_compiled_tpl() )

here's a quick fix script
[php:1:9c13ad42a9]
<?php
$smarty_class = 'location/to/Smarty.class.php'
$delete_dir_contents = '/home/user/public_html/dir/content/to/delete'

include($smarty_class);
$smarty = new Smarty();
$smarty->compile_dir = $delete_dir_contents;
$smarty->clear_compiled_tpl();
?>
[/php:1:9c13ad42a9]
_________________
my delimiters are <{ and }>
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Sat Jan 24, 2004 1:59 pm    Post subject: Reply with quote

you can do the following.

(in the shell)
mkdir templates_c
chown templates_c apacheuser.sshgroup
chmod 770 templates_c
(on System V and Linux you additionally have to do:
chmod g+s templates_c
)

this makes the directory writable for apache, but the files belong to the group of your ssh-account.

some of the steps may need root-permissions. ask your admin in case.

then make sure smarty writes files group-writable:
(in php)
umask(0002);
$smarty->_file_perms = 0660;
$smarty->_dir_perms = 0770;


you should end up with compiled templates that are owned by the apacheuser (nobody in your case) but via the group-permissions they are also readable and writeable (and deletable) by your ssh-user.

HTH
messju
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ZeroFill
Smarty Rookie


Joined: 31 Aug 2003
Posts: 28

PostPosted: Sat Jan 24, 2004 7:59 pm    Post subject: Reply with quote

ah, cool. thanks messju
_________________
my delimiters are <{ and }>
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP