DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • December 11, 2017, 07:28:53 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: optimize tables  (Read 2489 times)
0 Members and 1 Guest are viewing this topic.
Jim
Guest
« on: March 13, 2005, 07:27:11 AM »

Another request....

Could one of you fine folks make a module that will allow you to optimize tables from within the game?

Logged
lonnyl
Guest
« Reply #1 on: March 13, 2005, 08:12:09 AM »

As I remember from looking at the code a while back that the game periodically optimizes the tables on it's own.
Logged
Dannic
Guest
« Reply #2 on: March 13, 2005, 08:22:44 AM »

That's what kendear mentioned a while back on the same subject.
Logged
enderwiggin
Guest
« Reply #3 on: March 13, 2005, 05:08:30 PM »

I think it happens once a day.
Logged
Sichae
iMod God
SVN Users
Mod God
*
Offline Offline

Posts: 3458


If ya didn't get it by now... you're hopeless...


View Profile WWW
« Reply #4 on: March 13, 2005, 05:11:49 PM »

Yup.

Code:
   if (strtotime(getsetting("lastdboptimize", date("Y-m-d H:i:s", strtotime("-1 day")))) < strtotime("-1 day")){
      savesetting("lastdboptimize",date("Y-m-d H:i:s"));
      $result = db_query("SHOW TABLES");
      $tables = array();
      $start = getmicrotime();
      for ($i=0;$i<db_num_rows($result);$i++){
         list($key,$val)=each(db_fetch_assoc($result));
         db_query("OPTIMIZE TABLE $val");
         array_push($tables,$val);
      }
      $time = round(getmicrotime() - $start,2);
      include_once("lib/gamelog.php");
      gamelog("Optimized tables: ".join(", ",$tables)." in $time seconds.","maintenance");
   }

Bottom of newday.php
« Last Edit: March 13, 2005, 05:14:37 PM by Sichae » Logged

If you didn't understand anything in the above post, don't try to attempt anything suggested.

Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Please take the time to read the FAQ and browse the DragonPedia

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
17 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search