forked from poppyred/1.6.x
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mysql.innodb.file.per.table.php
executable file
·118 lines (87 loc) · 3.3 KB
/
mysql.innodb.file.per.table.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
if(isset($_GET["verbose"])){$GLOBALS["VERBOSE"]=true;ini_set('html_errors',1);ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);}
include_once('ressources/class.templates.inc');
include_once('ressources/class.ldap.inc');
include_once('ressources/class.users.menus.inc');
include_once('ressources/class.mysql.inc');
include_once('ressources/class.system.network.inc');
include_once('ressources/class.os.system.inc');
include_once('ressources/class.mysql-multi.inc');
$usersmenus=new usersMenus();
if(!$usersmenus->AsAnAdministratorGeneric){
$tpl=new templates();
echo $tpl->_ENGINE_parse_body("alert('{ERROR_NO_PRIVS}');");
die();
}
if(isset($_POST["InnoDBFilePerTableAsk"])){InnoDBFilePerTableAsk();exit;}
if(isset($_POST["ConvertInnoDB"])){ConvertInnoDB();exit;}
page();
function page(){
$page=CurrentPageName();
$tpl=new templates();
$q=new mysql();
$databases=$q->DATABASE_LIST();
while (list ($database, $line) = each ($databases) ){
$tbs=$tbs+$line[0];
$tx=trim($line[1]);
$re=explode(" ", $tx);
$tsize=$re[0];
$unit=$re[1];
if($unit=="KB"){$size=$size+$tsize;}
if($unit=="MB"){$tsize=intval($tsize)*1024;$size=$size+$tsize;}
if($unit=="GB"){$tsize=intval($tsize)*1024;$tsize=$tsize*1024;$size=$size+$tsize;}
}
$text=$tpl->_ENGINE_parse_body("{INNODB_FILE_PER_TABLE_ASK}");
$size=FormatBytes($size);
$text=str_replace("%free", "<strong>$size</strong>", $text);
$text=str_replace("%tablesnum", "<strong>$tbs</strong>", $text);
$t=time();
$html="
<table style='width:99%' class=form>
<tr>
<td valign='top' width=1%><img src='img/database-connect-128.png'></td>
<td valign='top' width=99% style='padding-left:20px'>
<div style='font-size:18px;font-weight:bold'>InnoDB File per Table</div>
<div id='$t-div'></div>
<div style='font-size:14px'>$text</div>
<div style='margin:10px;text-align:center'>". button("{i_understand_continue}","SaveContinue$t()","18px")."</div>
<div style='margin:10px;text-align:center'>". button("{convertto_innodb_file_per_table}","ConvertInnodb$t()","18px")."</div>
<div style='margin:10px;text-align:center'>
<a href=\"javascript:blur();\" OnClick=\"javascript:s_PopUpFull('http://www.mail-appliance.org/index.php?cID=278','1024','900');\"
style='font-size:18px;'>{online_help}</a>
</td>
</tr>
</table>
<script>
var x_SaveContinue$t= function (obj) {
var tempvalue=obj.responseText;
if(tempvalue.length>3){alert(tempvalue)};
document.location.href='admin.index.php';
}
function SaveContinue$t(){
var XHR = new XHRConnection();
XHR.appendData('InnoDBFilePerTableAsk','yes');
AnimateDiv('$t-div');
XHR.sendAndLoad('$page', 'POST',x_SaveContinue$t);
}
function ConvertInnodb$t(){
var XHR = new XHRConnection();
XHR.appendData('ConvertInnoDB','yes');
AnimateDiv('$t-div');
XHR.sendAndLoad('$page', 'POST',x_SaveContinue$t);
}
</script>
";
echo $tpl->_ENGINE_parse_body($html);
}
function InnoDBFilePerTableAsk(){
$sock=new sockets();
$sock->SET_INFO("InnoDBFilePerTableAsk", 1);
}
function ConvertInnoDB(){
$sock=new sockets();
$sock->SET_INFO("InnoDBFilePerTableAsk", 1);
$sock->getFrameWork("mysql.php?convert-innodb-file-persize=yes");
$tpl=new templates();
echo $tpl->javascript_parse_text("{convert_background_warn}",1);
}