PDA

View Full Version : Running daily MYSQL queries


Morrus
09-13-2013, 07:34 PM
This is probably a very, very basic question. I assume the Cron tool is involved in some way, but let's assume I'm a dummy and know nothing about crons and PHP...

Assuming I know exactly what query it is I want to run, and run it manually fairly often, how do I schedule it to run automatically on a daily basis and save me that work?

kh99
09-13-2013, 07:50 PM
You can create a plugin using hook location "cron_script_cleanup_daily", and write code to do your query. You should use one of the vbulletin db functions like $vbulletin->db->query_read() or $vbulletin->db->query_write() (query_write() I'd assume, since you probably want to change the database as opposed to reading data).

Zachery
09-13-2013, 07:54 PM
I'm always curious, what queries do you want to run daily?

Morrus
09-13-2013, 09:13 PM
You can create a plugin using hook location "cron_script_cleanup_daily", and write code to do your query. You should use one of the vbulletin db functions like $vbulletin->db->query_read() or $vbulletin->db->query_write() (query_write() I'd assume, since you probably want to change the database as opposed to reading data).

Ah, sounds like I'd need to know how to code. I was hoping it was simpler than that!

I'm always curious, what queries do you want to run daily?

Just something that assigns thread prefixes based on the presence of certain keywords in thread titles. I need to apply it to my RSS feeds forum. It's easy enough to execute the query (well, a bunch of queries) manually, but I wanted to save myself the daily task.