Author |
Message |
dogs and things Board Member
Joined: 18 Nov 2008
Posts: 628 Location: Spain
|
Posted: Tue Jul 20, 2010 4:41 pm Post subject: Rebuild search MOD and CRON |
|
|
Hello,
I'm not a spammer so don´t shoot me.
Anybody using this MOD that has been able to figure out how to run it let's say every 24 hours with a cron job?
_________________ phpBB2 will never die, I hope! |
|
Back to top |
|
|
Salvatos Board Member
Joined: 19 Feb 2009
Posts: 449 Location: Québec
|
Posted: Tue Jul 20, 2010 6:44 pm Post subject: Re: Rebuild search MOD and CRON |
|
|
I don't know about the MOD, but I had a quick look at the code. It doesn't work on a cron job? Any error?
Getting rid of the IN_PHPBB stuff, headers, template and the like and placing the code in a private folder could do it (I place my cron files in /etc). You'd be keeping lines 40 to 118 essentially, with some tweaks on the variables and includes before those first lines. And you'd need to add a connection to the database since there would be no includes to do it anymore. You'll need to change the filepath on line 42 and set/replace the POST or GET variable, from inside the code, to your desired value.
There may very well be some more bits to change, I just had a quick look at it without knowing exactly its purpose. Chances are you could work the other way around and just take the queries out of it and make your own file, leaving out everything that relies on admin input or displays something.
|
|
Back to top |
|
|
dogs and things Board Member
Joined: 18 Nov 2008
Posts: 628 Location: Spain
|
|
Back to top |
|
|
Salvatos Board Member
Joined: 19 Feb 2009
Posts: 449 Location: Québec
|
Posted: Wed Jul 21, 2010 3:12 am Post subject: Re: Rebuild search MOD and CRON |
|
|
Oh, looks like I wasn't looking at the right MOD. This one seems a lot more complex and I unfortunately don't have enough time to look into this. Sorry
|
|
Back to top |
|
|
dogs and things Board Member
Joined: 18 Nov 2008
Posts: 628 Location: Spain
|
Posted: Wed Jul 21, 2010 3:20 am Post subject: Re: Rebuild search MOD and CRON |
|
|
Don't worry, I appreciate your time anyway, and I guess I should have posted more info about the MOD in the first place.
Greetings.
_________________ phpBB2 will never die, I hope! |
|
Back to top |
|
|
Citrix Board Member
Joined: 19 Feb 2012
Posts: 42
|
Posted: Thu Feb 23, 2012 10:40 am Post subject: Re: Rebuild search MOD and CRON |
|
|
it's easier to add a cron using ssh if your host gives you access.
Put the file you want to execute in a folder somewhere. And add a small file in the folder /etc/cron.d to execute the task.
There are zillions of samples cron on the web.. Just google. You can almost automate any tasks for your site maintenance. I just learned all that the last 8 weeks, as my site was under heavy attacks and I was learning to defend myself. I can't believe I own a phpbb site all those years without setting up these small defensive mechanism. Google and learn. You'll love crons if you can write small programs.
|
|
Back to top |
|
|
dogs and things Board Member
Joined: 18 Nov 2008
Posts: 628 Location: Spain
|
Posted: Thu Feb 23, 2012 10:55 am Post subject: Re: Rebuild search MOD and CRON |
|
|
Thanks for wiping of the dust!
I can set up cron jobs without a problem,
The thing is that I don´t know what to run, I'd have to add some parameters and I don´t know how to find out which ones to use to make the rebuild search with the proper settings.
_________________ phpBB2 will never die, I hope! |
|
Back to top |
|
|
Citrix Board Member
Joined: 19 Feb 2012
Posts: 42
|
Posted: Thu Feb 23, 2012 11:15 am Post subject: Re: Rebuild search MOD and CRON |
|
|
dogs and things wrote: | Thanks for wiping of the dust! | Exactly. Thanks.. I'd like this board to be busy with phpbb2 folks.
We have quite a few people still using phpbb2 and we should all find our way here to help each other.
Had I set up this site, I would not have called it phpbbrefugee. .. I think it should be called phpbb2 World Headquarter.
We are phpbb2.
As for the cron, I went a bit too fast. I have never installed that Mod. I don't know anything about it, so I spoke in general about crons.
|
|
Back to top |
|
|
Salvatos Board Member
Joined: 19 Feb 2009
Posts: 449 Location: Québec
|
Posted: Thu Feb 23, 2012 12:05 pm Post subject: Re: Rebuild search MOD and CRON |
|
|
Had a quick look at the install file and the main file. I've never tried something like this, but maybe you can just specify GET parameters in your cron job's choice of script.
Example: '(...)admin_rebuild_search.php?mode=submit&start=0&clear_search=1...' (skipped the cron part since you know how to do it and I forget )
Basically you can look at the code and everywhere you see $HTTP_GET_VARS should be a parameter being checked in the URL. You can see above I specify mode=submit to launch the script (other options included refresh), start=0 to start at post_id 0 and clear_search=1 to clear the search tables. You can compare with the interface in the ACP to help you along the way.
One problem I can think of is admin privileges. Your cron probably won't be allowed to execute the code, and I'm not sure you can give it a fake admin session. But if you don't none of the includes are going to work and it's just going to get a redirect, I think...
|
|
Back to top |
|
|
Citrix Board Member
Joined: 19 Feb 2012
Posts: 42
|
Posted: Thu Feb 23, 2012 12:38 pm Post subject: Re: Rebuild search MOD and CRON |
|
|
what does this Mod do?
Too lazy to dowload it and read all about it..
|
|
Back to top |
|
|
dogs and things Board Member
Joined: 18 Nov 2008
Posts: 628 Location: Spain
|
Posted: Thu Feb 23, 2012 2:00 pm Post subject: Re: Rebuild search MOD and CRON |
|
|
Thanks for the suggestions Salvatos, I'll take a look.
Quote: | ## This mod will index every post in your forum, rebuilding the search tables.
##
## This is useful when :
##
## - You have imported posts from another forum
## - You have lost/deleted/corrupted your phpbb search tables in one way or another
## - You want to transfer your db to another server (you can skip the copying of search tables
## which are usually quite a lot of MB and create them on the new server from scratch)
## - You have updated the "search_stopwords.txt" file (running the mod will remove these words from the search tables)
## - Users cannot find what they are searching for in your forum (although there could many other reasons for this)
##
## You can stop whenever you like and the next time you run it again, you'll have the option of
## continuing from where you left off.
|
_________________ phpBB2 will never die, I hope! |
|
Back to top |
|
|
Citrix Board Member
Joined: 19 Feb 2012
Posts: 42
|
Posted: Thu Feb 23, 2012 2:07 pm Post subject: Re: Rebuild search MOD and CRON |
|
|
thanks... that looks like a Must Have.
|
|
Back to top |
|
|
|