1
McDonald
Automatically deleting files in cache/templates_c dir on admin logout
  • 2005/11/8 11:33

  • McDonald

  • Home away from home

  • Posts: 1072

  • Since: 2005/8/15


Is there a way to have the directories cache and templates_c automatically cleaned when the administrator of a website logs out?

Kind regards,

McDonald

2
m0nty
Re: Automatically deleting files in cache/templates_c dir on admin logout
  • 2005/11/8 12:19

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


there is a way yes with some hacking of the core, but why would you want to? it kinda defeats the whole concept of cache and compiled pages.

they would be regenerated everytime someone views a page anyway, whether they are anonymous or admin or registered user..

3
Shine
Re: Automatically deleting files in cache/templates_c dir on admin logout
  • 2005/11/8 13:25

  • Shine

  • Just can't stay away

  • Posts: 822

  • Since: 2002/7/22


I know there has been a module for the admin so he/she could clean up the template_c dir from out the XOOPS administration section.
Unfortunately I don't know where I've seen it, since it is a long time ago.

[edit]
Did a strong search.......yes yes found it finally:
See: Templates_c Cleaner module
[/edit]

Grtz., Shine

4
McDonald
Re: Automatically deleting files in cache/templates_c dir on admin logout
  • 2005/11/8 13:56

  • McDonald

  • Home away from home

  • Posts: 1072

  • Since: 2005/8/15


I am using WF-Links on my frontpage and only registered visitors can submit a link.
This means that when somebody signs in the 'Submit link' option will be visible to him/her and otherwise not.
Recently I noticed that when cache has been selected for WF-Links that 'Submit link' stays visible after logging out.
When clicking 'Submit link' you're taken for a short while to the admin panel with a 'Sorry, you don't have permission' message. I don't mind the message but I don't like it that anonymous visitors are taken to the admin panel even for a short time.
So I thought that automatically cleaning the 2 folders would solve the problem. It should not only do this for admins but also when a registered visitor logs out of course.

I have the module to clean the templates_c folder installed.

5
Dave_L
Re: Automatically deleting files in cache/templates_c dir on admin logout
  • 2005/11/8 15:08

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


That's the main headache of caching: how to cache a page that contains user-specific information.

For modules in which I've had the problem, I've solved it by disabling caching for those pages.

There might be a better solution for your case, but I'm not familiar with the WF-Links module.

6
McDonald
Re: Automatically deleting files in cache/templates_c dir on admin logout
  • 2005/11/8 15:43

  • McDonald

  • Home away from home

  • Posts: 1072

  • Since: 2005/8/15


I prefer to have caching enabled to speed up my site because WF-Links is using 165 categories and over 1300 links.
I think actually that the solution for this should be in the module and not in XOOPS itself.

7
Dave_L
Re: Automatically deleting files in cache/templates_c dir on admin logout
  • 2005/11/8 16:50

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


I recalled a similar issue I dealt with in my chess module by having the submit link only in the main menu, and placing code in the module's xoops_version.php so that the link is only shown to authorized users.

Here's the relevant code.

...
$modversion['sub'][2]['name'] = _MI_CHESS_SMNAME2;
$modversion['sub'][2]['url']  = 'index.php';

// Conditional menu items
global $xoopsModule$xoopsModuleConfig$xoopsUser;
if (
is_object($xoopsModule) and $xoopsModule->getVar('dirname') == 'chess') {

// Display create-game menu item if current user has the play-chess right.
    
if (!empty($xoopsModuleConfig['groups_play']) and is_array($xoopsModuleConfig['groups_play'])
        and (
            
in_array(XOOPS_GROUP_ANONYMOUS$xoopsModuleConfig['groups_play'])
            or (
                
is_object($xoopsUser) and count(array_intersect($xoopsUser->getGroups(), $xoopsModuleConfig['groups_play'])) > 0
            
)
        )
    )
    {
        
$modversion['sub'][3]['name'] = _MI_CHESS_SMNAME3;
        
$modversion['sub'][3]['url']  = 'create.php';
    }

// Display ratings menu item if ratings system is enabled.
    
if ($xoopsModuleConfig['rating_system'] != 'none') {
        
$modversion['sub'][4]['name'] = _MI_CHESS_SMNAME4;
        
$modversion['sub'][4]['url']  = 'ratings.php';
    }

// Display my-games menu item if current user is logged in.
    
if (is_object($xoopsUser)) {
        
$modversion['sub'][5]['name'] = _MI_CHESS_SMNAME5;
        
$modversion['sub'][5]['url']  = 'player_stats.php?player_uid=' $xoopsUser->getVar('uid');
    }
}
...

8
McDonald
Re: Automatically deleting files in cache/templates_c dir on admin logout
  • 2005/11/8 22:40

  • McDonald

  • Home away from home

  • Posts: 1072

  • Since: 2005/8/15


Thanks for the reply.
I will see what I can do with the script.

Thanx!

Login

Who's Online

179 user(s) are online (98 user(s) are browsing Support Forums)


Members: 0


Guests: 179


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits