analyze.php
资源名称:BBWPS.rar [点击查看]
上传用户:yttaitong
上传日期:2009-05-10
资源大小:128k
文件大小:2k
源码类别:
WEB源码(ASP,PHP,...)
开发平台:
PHP
- <?PHP
- /*
- [BBWPS!] (C)2006-2010 小蜜蜂版权所有.
- This is NOT a freeware, use is subject to license terms
- 时间:2007年12月
- 描述:数据库优化
- */
- error_reporting(0);
- require_once("global.php");
- $db=new DB($hostname,$username,$password,$database);
- $p=new Template("./templates");
- $mysql_do=$_GET["action"];
- //--------------------------------------
- //获得上次备份的信息
- //--------------------------------------
- $backupPath="../../";
- if(file_exists($backupPath."config/backup.php")){
- require($backupPath."config/backup.php");
- }
- //--------------------------------------
- //显示表的详细信息
- //--------------------------------------
- if(!$mysql_do){
- $sql="show table status from $database";
- $db->query($sql,true);
- while ($rs1=$db->fetch_object()){
- if(array_key_exists($rs1->Name,$backup)){
- //[显示每个表的信息]
- $p->set_file("handle_table","bl_row.html");
- $p->set_var("tablename",$rs1->Name);
- $p->set_var("rows",$rs1->Rows);
- $p->set_var("comment",$rs1->Comment);
- $p->set_var("create_time",$rs1->Create_time);
- $p->set_var("update_time",$rs1->Update_time);
- $p->set_var("data_length",$rs1->Data_length);
- $p->set_var("backup_time","还没有备份");
- if(isset($backup)){
- foreach ($backup as $key=>$value){
- if($key==$rs1->Name&&$value[0]!=0){
- $p->set_var("backup_time",date("Y-m-d H:i:s",$value[0]));
- break;
- }
- }
- }
- $p->parse("link","handle_table",true);
- }
- //[/显示每个表的信息]
- }
- $p->set_file("handle","browselist.html");
- $p->set_var("action","analyze");
- $p->set_var("submitvalue","分析选中");
- $p->parse("output","handle");
- $p->p("output");
- unset($p);
- }
- else{
- foreach ($_POST["tablename"] as $key=>$value){
- $string.="`$value`,";
- }
- $string=substr($string,0,-1);
- $sql ='ANALYZE TABLE '.$string;
- $db->query($sql,true);
- while ($rs1=$db->fetch_array()){
- $p->set_file("handle_st","st_row.html");
- $p->set_var($rs1);
- $p->parse("list","handle_st",true);
- }
- $p->set_file("handle","status.html");
- $p->parse("output","handle");
- $p->p("output");
- }
- $db->__DB();
- ?>