Quote:
Originally posted by David Bott
Now...Might I kindly ask a question. That being...Why is all this code in the index.php file? I mean...if it is only used once a day...why must it all this be in this file that is called over and over and over again? It just seems like a lot of extra overhead.
Now I did not know PHP or coding...But I was just wondering if it all being their does not hurt some? Would it make a difference if the code just checks the date and then if the date has moved to then call the code? Or is that what it is actually doing now?
I am just wondering so I can learn the logic and understand.
|
I respect your concerns and all your stated questions are quite relavant. They should have been already asked by all users who installed this hack.

So let me clarify the logic and algorithm of the hack and relieve your worries:
First things first: as I mentioned in my first message this hack is carefully coded and QUITE performance-friendly. That is:
* The hack by no means increase your SQL load by unnecessary queries.
* Does not effect your script running time.
* Having a heavy traffic, too many visitors or hack's integration with index.php (the most called vbulletin file) does not change these facts in any way.
Here is how:
Contrary to what expected, the hack does not check the birtdays of the board members everytime index.php runs. This would slow your board and add unnecessary queries since going through with all members birthdays in the database would be a slow process and would cause a heavy load. Instead the hack is designed to first check the date of "today" and the last day of greetings, before elobarating on today's birthdays. This requires 1 SQL query per run. Considering the fact that your index.php deals with (avaragely) 20 to 40 SQL queries in its EVERY run, this 1 extra query (which is a VERY FAST one btw) would be quite bearable. BUT hack does NOT even add this query load to your server! To save you from even this tiny extra load, I added another feature to the hack: Server Load variable you set in the options. This optimizes the hack to run ONLY 3 times (avaragely) a day to check if hack already greeted the birthdays today and if not runs 1 time a day to greet them.
So lets make a simple calculation: if your main page of your board has a daily 1000 visitors,
* Your index.php produces an estimated of 30000 SQL queries a day (without this hack.)
* After you installed the hack your estimated SQL queries will be 30004 ONLY.
Does having a large code in the most running file (index.php) of your server decreases the script running performance in any way? One word: Nope. The hack's code is covered with an "IF conditional" in the begining and even if your index.php runs 1.000.000 times a day, this whole block of code will be skipped (except 3 times in a day) and having it there wouldnt even effect your running time in miliseconds.
So you can use it without any worries about SQL/Server/Script performance. It's really a very well thought and coded hack.. Hope this clarifies the performance issues of the hack.
Regards,
Logician