Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
Size of the database in main.mdu

 
Reply to topic    Forum Index » General feedback View previous topic
View next topic
Size of the database in main.mdu
Author Message
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2818
Location: Germany

Post Size of the database in main.mdu Reply with quote
This little hack adds the table size to the statistics part in main.mdu.



Open main.mdu and find this:

Code:
echoheader('home', $echo['header']);




add below:

Code:
if ($config_database != 'txtsql'){

//////////////////////

//Check the table size

$query = "SHOW TABLE STATUS";

$result = mysql_query($query);

$i = 0;

while($row = mysql_fetch_array($result)){

   $output[$i] = $row['Data_length'];

   $i++;

}

$size = array('users' => $output[6], 'story' => $output[4] + $output[5], 'comments' => $output[1], 'categories' => $output[0]);

}




Find this:

Code:
      if ($config_database == 'txtsql'){

?>



(<small><?=formatsize(filesize(rootpath.'/data/db/base/'.$k.'.MYD')); ?></small>)



<?

      }




add below:

Code:
   else {?><td align="right"><small><?=formatsize($size[$k]); ?></small></td><?}




Or get it with the latest CuteNews.RU download file.
Fri Oct 21, 2005 11:22 am View user's profile Send private message
Guest








Please login to hide the ads.

lexa
Creator of CuteNews.RU


Joined: 02 Oct 2005
Posts: 90
Location: St.-Petersburg, Russia

Post Reply with quote
Super! I add it.
Fri Oct 21, 2005 7:05 pm View user's profile Send private message Visit poster's website ICQ Number
Mr R



Joined: 27 Sep 2005
Posts: 82
Location: Spain

Post Reply with quote
how can we put in main "optimization of database" and "backup of data" base information as txt
Fri Oct 21, 2005 7:09 pm View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2818
Location: Germany

Post Reply with quote
Mr R wrote:
how can we put in main "optimization of database" and "backup of data" base information as txt


"Optimization of database" - I made this for CuteSQL. I can add it without problems. Tomorrow. Very Happy

"Backup of data" - I don't know.
Sat Oct 22, 2005 1:15 pm View user's profile Send private message
Mr R



Joined: 27 Sep 2005
Posts: 82
Location: Spain

Post Reply with quote
Haha ok, database backup like phpbb have Wink look, you can download your database information as a txt file
Sat Oct 22, 2005 2:02 pm View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2818
Location: Germany

Post Reply with quote
Of course. Smile



I didn't mean to say "I don't know what it is" but "I don't know how to do it".
Sat Oct 22, 2005 2:06 pm View user's profile Send private message
Mr R



Joined: 27 Sep 2005
Posts: 82
Location: Spain

Post Reply with quote
haha ok, don't worry, my failure Razz i can wait
Sat Oct 22, 2005 2:26 pm View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2818
Location: Germany

Post Reply with quote
"Optimization of database":



In main.mdu change this:

Code:
if ($config_database != 'txtsql'){

//////////////////////

//Check the table size

$query = "SHOW TABLE STATUS";

$result = mysql_query($query);

$i = 0;

while($row = mysql_fetch_array($result)){

   $output[$i] = $row['Data_length'];

   $i++;

}

$size = array('users' => $output[6], 'story' => $output[4] + $output[5], 'comments' => $output[1], 'categories' => $output[0]);



}




to this:

Code:
if ($config_database != 'txtsql'){

//////////////////////

//Check the table size and optimize table

$query = "SHOW TABLE STATUS";

$result = mysql_query($query);

$i = 0;

while($row = mysql_fetch_array($result)){

   $output[$i] = $row['Data_length'];

   $i++;

   $wasted = $row['Data_free'];

   if ($wasted > 0) {

      $query2 = "OPTIMIZE TABLE ".$row['Name'];

      $results = mysql_query($query2);

   }

}

$size = array('users' => $output[6], 'story' => $output[4] + $output[5], 'comments' => $output[1], 'categories' => $output[0]);



}




Or get it with the latest CuteNews.RU download.
Sun Oct 23, 2005 10:46 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    Forum Index » General feedback All times are GMT + 1 Hour
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum



Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Music Lyrics.