[SOLVED] Clearing ACL cache manually?

Discussion forum for MOD Writers regarding MOD Development.
777Firebrand777
Registered User
Posts: 91
Joined: Sat Oct 27, 2012 5:03 pm

[SOLVED] Clearing ACL cache manually?

Post by 777Firebrand777 »

I'm trying to set up cron jobs which modifies some config values in certain times a week in phpbb_config and acl_groups table.

My problem is, when I modify acl_groups, it doesn't go "live" because phpbb caches the board.

I empty cache by inputing command "rm <home direcory>/cache/*.php

It works for some settings and templates, but won't work with ACLs. If I want refresh on ACLs I have to press purge cache button in ACP.

How could I purge ACL cache completely with a cron job / SQL command run?
Last edited by 777Firebrand777 on Thu Feb 26, 2015 11:33 am, edited 2 times in total.
User avatar
AmigoJack
Registered User
Posts: 6115
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン

Re: Clearing ACL cache manually?

Post by AmigoJack »

777Firebrand777 wrote:I have to press purge cache button in ACP
Why not looking up what that button does in /includes/acp/acp_main.php?

Code: Select all

case 'purge_cache':
...
    global $cache;
    $cache->purge();

    // Clear permissions
    $auth->acl_clear_prefetch();
...
break; 
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
777Firebrand777
Registered User
Posts: 91
Joined: Sat Oct 27, 2012 5:03 pm

Re: Clearing ACL cache manually?

Post by 777Firebrand777 »

That actually requires the server to log into the board.

I did something similar now, by implementing acl cache clear command in index php which only runs if i give a special argument in the url but this is not too safe if you agree with me, because everyone can run it. And I cannot chmod index.php on 700 to prevent this.

What I want to do is to find a way to clear the cache fully from linux shell script running a cron to support my other cron timed modifications on the board.
User avatar
AmigoJack
Registered User
Posts: 6115
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン

Re: Clearing ACL cache manually?

Post by AmigoJack »

777Firebrand777 wrote:That actually requires the server to log into the board
What? You can easily create a PHP file which executes all this without any output or input (speak: authentication). And PHP files are scripts, nothing else. Also: what's critical about clearing caches?
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: Clearing ACL cache manually?

Post by david63 »

Why not just make the config vars is_dynamic then they will automatically be updated
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
777Firebrand777
Registered User
Posts: 91
Joined: Sat Oct 27, 2012 5:03 pm

Re: Clearing ACL cache manually?

Post by 777Firebrand777 »

AmigoJack wrote:
777Firebrand777 wrote:That actually requires the server to log into the board
What? You can easily create a PHP file which executes all this without any output or input (speak: authentication). And PHP files are scripts, nothing else. Also: what's critical about clearing caches?
Sorry, I can't program in php, that's why I didn't know that. I just modify other people's work (my index.php modification was also borrowed from a guy's solution)

My security concern is if somebody knows how to argument my index.php file from outside, it can be used to slow down the server.

But if I have a standalone file which can be only executed by root, it's protected then.
david63 wrote:Why not just make the config vars is_dynamic then they will automatically be updated
Would you explain this for me please?
tmarone
Registered User
Posts: 1
Joined: Sun Apr 06, 2014 4:57 am

Clearing ACL cache manually?

Post by tmarone »

User avatar
AmigoJack
Registered User
Posts: 6115
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン

Re: Clearing ACL cache manually?

Post by AmigoJack »

777Firebrand777 wrote:Would you explain this for me please?
Ignore that post - I have no idea how that was supposed to help in any way.
777Firebrand777 wrote:I can't program in php
It's not that different from Perl or shell scripts. Create a PHP file with this content:

Code: Select all

<?php

define('IN_PHPBB', true);
$phpbb_root_path = './';  // Relative to your phpBB installation path
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

$cache->purge();
$auth->acl_clear_prefetch();

die( 'done' ); 
If it's not saved in the root of your phpBB installation adjust the variable where the comment is. To execute the script from the outside run wget http://yoursite.ext/thatscript.php. To execute it locally, change the directory to where that file resides and run php -f thatscript.php. Tested.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
777Firebrand777
Registered User
Posts: 91
Joined: Sat Oct 27, 2012 5:03 pm

Re: Clearing ACL cache manually?

Post by 777Firebrand777 »

tmarone wrote:viewtopic.php?f=71&t=1472175 maybe?
I did try this but somehow it didn't work. Maybe it's just me.
AmigoJack wrote:
777Firebrand777 wrote:Would you explain this for me please?
Ignore that post - I have no idea how that was supposed to help in any way.
777Firebrand777 wrote:I can't program in php
It's not that different from Perl or shell scripts. Create a PHP file with this content:

Code: Select all

<?php

define('IN_PHPBB', true);
$phpbb_root_path = './';  // Relative to your phpBB installation path
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

$cache->purge();
$auth->acl_clear_prefetch();

die( 'done' );  
If it's not saved in the root of your phpBB installation adjust the variable where the comment is. To execute the script from the outside run wget http://yoursite.ext/thatscript.php. To execute it locally, change the directory to where that file resides and run php -f thatscript.php. Tested.
This solution is working perfectly for me! My issue is solved. Thank you very much!

Return to “[3.0.x] MOD Writers Discussion”