' + lan.bt.edit_ps + '
'); tabCon.append(''); tabCon.append(''); tabCon.append(bt.render_help([lan.get('config_edit_ps', [version])])); var fileName = bt.soft.get_config_path(version); if (data.php_ini) fileName = data.php_ini; var loadT = bt.load(lan.soft.get); bt.send( 'GetFileBody', 'files/GetFileBody', { path: fileName, }, function (rdata) { loadT.close(); $('#textBody').text(rdata.data); $('.CodeMirror').remove(); var editor = CodeMirror.fromTextArea(document.getElementById('textBody'), { extraKeys: { 'Ctrl-Space': 'autocomplete', }, lineNumbers: true, matchBrackets: true, }); editor.focus(); $('.CodeMirror-scroll').css({ height: '510px', margin: 0, padding: 0, }); $('#OnlineEditFileBtn').click(function () { $('#textBody').text(editor.getValue()); bt.soft.save_config(fileName, editor.getValue()); }); } ); break; case 'fpm_config': var tabCon = $('.soft-man-con').empty(); tabCon.append('' + lan.bt.edit_ps + '
'); tabCon.append(''); tabCon.append(''); var _arry = ['If you do not understand the php-fpm configuration file, please do not modify it!']; tabCon.append(bt.render_help(_arry)); $('.return_php_info').click(function () { $('.bt-soft-menu p:eq(12)').click(); }); var fileName = bt.soft.get_config_path(version).replace('php.ini', 'php-fpm.conf'); var loadT = bt.load(lan.soft.get); var config = bt.aceEditor({ el: 'textBody', path: fileName }); $('#OnlineEditFileBtn').click(function () { bt.saveEditor(config); }); break; case 'change_version': var _list = []; var opt_version = ''; for (var i = 0; i < data.versions.length; i++) { if (data.versions[i].setup) opt_version = data.name + ' ' + data.versions[i].m_version; _list.push({ value: data.name + ' ' + data.versions[i].m_version, title: data.name + ' ' + data.versions[i].m_version, }); } var _form_data = { title: lan.soft.select_version, items: [ { name: 'phpVersion', width: '160px', type: 'select', value: opt_version, items: _list, }, { name: 'btn_change_version', type: 'button', text: lan.soft.version_to, callback: function (ldata) { if (ldata.phpVersion == opt_version) { bt.msg({ msg: 'Is already[' + opt_version + ']', icon: 2, }); return; } if (data.name == 'mysql') { var ver = ldata.phpVersion.split('mysql '), pdata = { sName: 'mysql', version: ver[1], type: 0 }; $.post('/plugin?action=check_install_limit', pdata, function (rdata) { if (rdata !== null && rdata.status == false) { bt.msg({ msg: rdata.msg, icon: 2, time: 3000 }); return false; } bt.database.get_list(1, '', function (ddata) { if (ddata.data.length > 0) { bt.msg({ msg: lan.soft.mysql_d, icon: 5, time: 5000, }); return; } bt.soft.install_soft(data, ldata.phpVersion.split(' ')[1], 0); }); }); } else { bt.soft.install_soft(data, ldata.phpVersion.split(' ')[1], 0); } }, }, ], }; bt.render_form_line(_form_data, '', $('.soft-man-con').empty()); break; case 'change_data_path': bt.send('GetMySQLInfo', 'database/GetMySQLInfo', {}, function (rdata) { var form_data = { items: [ { type: 'text', name: 'datadir', value: rdata.datadir, event: { css: 'glyphicon-folder-open', callback: function (obj) { bt.select_path(obj); }, }, }, { name: 'btn_change_path', type: 'button', text: lan.soft.mysql_to, callback: function (ldata) { var loadT = bt.load(lan.soft.mysql_to_msg1); bt.send( 'SetDataDir', 'database/SetDataDir', { datadir: ldata.datadir, }, function (rdata) { loadT.close(); bt.msg(rdata); } ); }, }, ], }; bt.render_form_line(form_data, '', $('.soft-man-con').empty()); }); break; case 'change_mysql_port': bt.send('GetMySQLInfo', 'database/GetMySQLInfo', {}, function (rdata) { var form_data = { items: [ { type: 'text', width: '100px', name: 'port', value: rdata.port, }, { name: 'btn_change_port', type: 'button', text: lan.public.edit, callback: function (ldata) { var loadT = bt.load(); bt.send( 'SetMySQLPort', 'database/SetMySQLPort', { port: ldata.port, }, function (rdata) { loadT.close(); bt.msg(rdata); } ); }, }, ], }; bt.render_form_line(form_data, '', $('.soft-man-con').empty()); }); break; case 'change_mysql_ssl': bt.send('check_mysql_ssl_status', 'database/check_mysql_ssl_status', {}, function (rdata) { var form_data = { title: 'Mysql SSL', items: [ { type: 'switch', name: 'write_ssl', value: rdata, }, ], }; bt.render_form_line(form_data, '', $('.soft-man-con').empty()); var downssl = '/www/server/data/ssl.zip'; $('.soft-man-con').append( bt.render_help(['After setting, manually restart the database to take effect', "Download Mysql SSL self-signed certificate【SSL.zip】"]) ); $('a.downssl').click(function () { window.open('/download?filename=' + encodeURIComponent(downssl)); }); $('#write_ssl').change(function () { var loadT = bt.load(); $.post('/database?action=write_ssl_to_mysql', function (rdata) { loadT.close(loadT); var open_type = $('#write_ssl').prop('checked') ? 'turned on' : 'turned off', loadP = layer.confirm( 'The SSL setting is ' + open_type + ' successfully.| ' + lan.soft.mysql_status_title1 + ' | ' + getLocalTime(rdata.Run) + ' | ' + lan.soft.mysql_status_title5 + ' | ' + parseInt(rdata.Questions / rdata.Uptime) + ' |
|---|---|---|---|
| ' + lan.soft.mysql_status_title2 + ' | ' + rdata.Connections + ' | ' + lan.soft.mysql_status_title6 + ' | ' + parseInt((parseInt(rdata.Com_commit) + parseInt(rdata.Com_rollback)) / rdata.Uptime) + ' |
| ' + lan.soft.mysql_status_title3 + ' | ' + ToSize(rdata.Bytes_sent) + ' | ' + lan.soft.mysql_status_title7 + ' | ' + rdata.File + ' |
| ' + lan.soft.mysql_status_title4 + ' | ' + ToSize(rdata.Bytes_received) + ' | ' + lan.soft.mysql_status_title8 + ' | ' + rdata.Position + ' |
| \ \ | ||
|---|---|---|
| ' + lan.soft.mysql_status_title9 + ' | ' + rdata.Threads_running + '/' + rdata.Max_used_connections + ' | ' + lan.soft.mysql_status_ps1 + ' |
| ' + lan.soft.mysql_status_title10 + ' | ' + (!isNaN(title10) ? title10 : '0') + '% | ' + lan.soft.mysql_status_ps2 + ' |
| ' + lan.soft.mysql_status_title11 + ' | ' + (!isNaN(title11) ? title11 : '0') + '% | ' + lan.soft.mysql_status_ps3 + ' |
| ' + lan.soft.mysql_status_title12 + ' | ' + (!isNaN(title12) ? title12 : '0') + '% | ' + lan.soft.mysql_status_ps4 + ' |
| ' + lan.soft.mysql_status_title13 + ' | ' + cache_size + ' | ' + lan.soft.mysql_status_ps5 + ' |
| ' + lan.soft.mysql_status_title14 + ' | ' + (!isNaN(title14) ? title14 : '0') + '% | ' + lan.soft.mysql_status_ps6 + ' |
| ' + lan.soft.mysql_status_title15 + ' | ' + rdata.Open_tables + ' | ' + lan.soft.mysql_status_ps7 + ' |
| ' + lan.soft.mysql_status_title16 + ' | ' + rdata.Select_full_join + ' | ' + lan.soft.mysql_status_ps8 + ' |
| ' + lan.soft.mysql_status_title17 + ' | ' + rdata.Select_range_check + ' | ' + lan.soft.mysql_status_ps9 + ' |
| ' + lan.soft.mysql_status_title18 + ' | ' + rdata.Sort_merge_passes + ' | ' + lan.soft.mysql_status_ps10 + ' |
| ' + lan.soft.mysql_status_title19 + ' | ' + rdata.Table_locks_waited + ' | ' + lan.soft.mysql_status_ps11 + ' |
\ ' + lan.soft.mysql_log_bin + ' ' + ToSize(rdata.msg) + '\ \
' + lan.soft.mysql_log_err + '
\ \ '; $('.soft-man-con').html(limitCon); //设置二进制日志 $('.btn-bin').click(function () { var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: 0.3, }); $.post('/database?action=BinLog', '', function (rdata) { layer.close(loadT); layer.msg(rdata.msg, { icon: rdata.status ? 1 : 5, }); soft.get_tab_contents('mysql_log'); }); }); //清空日志 $('.btn-clear').click(function () { var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: 0.3, }); $.post('/database?action=GetErrorLog', 'close=1', function (rdata) { layer.close(loadT); layer.msg(rdata.msg, { icon: rdata.status ? 1 : 5, }); soft.get_tab_contents('mysql_log'); }); }); bt.send('GetErrorLog', 'database/GetErrorLog', {}, function (error_body) { if (error_body.status === false) { layer.msg(error_body.msg, { icon: 5, }); error_body = lan.soft.mysql_log_ps1; } if (error_body == '') error_body = lan.soft.mysql_log_ps1; $('#error_log').text(error_body); var ob = document.getElementById('error_log'); ob.scrollTop = ob.scrollHeight; }); } ); break; case 'mysql_slow_log': var loadT = bt.load(); bt.send('GetSlowLogs', 'database/GetSlowLogs', {}, function (logs) { loadT.close(); if (!logs.status) { logs.msg = ''; } if (logs.msg == '') logs.msg = lan.soft.no_slow_log; var phpCon = ''; $('.soft-man-con').html(phpCon); var ob = document.getElementById('error_log'); ob.scrollTop = ob.scrollHeight; }); break; case 'log': var loadT = bt.load(lan.public.the_get); bt.send( 'GetOpeLogs', 'ajax/GetOpeLogs', { path: '/www/wwwlogs/nginx_error.log', }, function (rdata) { loadT.close(); if (rdata.msg == '') rdata.msg = lan.soft.no_log; var ebody = ''; $('.soft-man-con').html(ebody); var ob = document.getElementById('error_log'); ob.scrollTop = ob.scrollHeight; } ); break; case 'nginx_status': var loadT = bt.load(); bt.send('GetNginxStatus', 'ajax/GetNginxStatus', {}, function (rdata) { loadT.close(); $('.soft-man-con').html("| Name | Format | Opt |
|---|
| Name | Format | Opt |
|---|
| ' + lan.soft.field + ' | ' + lan.soft.curr_val + ' | ' + lan.soft.instructions + ' |
|---|
' + lan.soft.pma_user + '
\' + lan.soft.pma_pass1 + '
\' + lan.soft.pma_pass2 + '
\ \| ' + lan.soft.version + ' | ' + php_info.phpinfo.php_version + ' | ' + lan.soft.install_path + ' | ' + php_info.phpinfo.php_path + ' |
| php.ini | ' + php_info.phpinfo.php_ini + ' | ||
| ' + lan.soft.loaded + ' | ' + php_info.phpinfo.modules + ' | ||
' + php_info.phpinfo.keys[k] + '
'; con += '| ' + key + ' | ' + p_status[php_info[k][key]] + ' | '; nkey++; if (nkey >= 3) { nkey = 0; con += '
' + rdata[i].name + '' + ibody + ', ' + rdata[i].ps + '
'; } var tabCon = $('.soft-man-con').empty(); tabCon.append('| ' + lan.soft.field + ' | ' + lan.soft.curr_val + ' | ' + lan.soft.instructions + ' |
|---|
' + lan.soft.name + ':' + data.title + '
\' + lan.soft.version + ':' + data.versions + '
\' + lan.soft.ps + ':' + data.ps + '
\' + lan.soft.size + ':' + bt.format_size(data.size, true) + '
\' + lan.soft.author + ':' + data.author + '
\' + lan.soft.source + ':' + data.home + '
\
', {
icon: 16,
time: 0,
shade: [0.3, '#000'],
});
$.post('/deployment?action=AddPackage', pdata, function (rdata) {
layer.close(loadT);
layer.msg(rdata.msg, {
icon: rdata.status ? 1 : 5,
});
if (rdata.status) {
GetSrcList();
layer.close(openId);
}
});
return;
}
openId = layer.open({
type: 1,
skin: 'demo-class',
area: '480px',
title: '添加源码包',
closeBtn: 2,
shift: 5,
shadeClose: false,
content:
'Title:
', {
icon: 16,
time: 0,
shade: [0.3, '#000'],
});
var data = $('#addweb').serialize() + '&port=' + Webport + '&webname=' + domain + '&ftp=false&sql=true&address=localhost&codeing=utf8&version=' + php_version;
$.post('/site?action=AddSite', data, function (ret) {
layer.close(loadT);
if (!ret.siteStatus) {
layer.msg(ret.msg, {
icon: 5,
});
return;
}
layer.close(add);
var sqlData = '';
if (ret.databaseStatus) {
sqlData =
"Database account information
\Database name:" + ret.databaseUser + '
\User:' + ret.databaseUser + '
\Password:' + ret.databasePass + '
\ '; } var pdata = 'dname=' + codename + '&site_name=' + mainDomain + '&php_version=' + php_version; var loadT = layer.msg('
Successfully deployed, no need to install, please login to modify the default account password.
\User:" + rdata.msg.admin_username + '
\Password:' + rdata.msg.admin_password + '
\ '; } sqlData += "Visit site:http://" + mainDomain + rdata.msg.success_url + '
'; layer.open({ type: 1, area: '600px', title: 'Successfully deployed [' + title + ']', closeBtn: 2, shadeClose: false, content: "
正在' +
speed.name +
' 
' + ToSize(speed.used) + '/' + ToSize(speed.total) + '' + ToSize(speed.speed) + '/s
'; $('.depSpeed').prev().hide(); $('.depSpeed').css({ 'margin-left': '-37px', width: '380px', }); $('.depSpeed').parents('.layui-layer').css({ 'margin-left': '-100px', }); } else { speed = '' + speed.name + '
'; $('.depSpeed').prev().show(); $('.depSpeed').removeAttr('style'); $('.depSpeed').parents('.layui-layer').css({ 'margin-left': '0', }); } $('.depSpeed').html(speed); setTimeout(function () { GetSpeed(); }, 1000); }); } function onekeyCodeSite(codename, versions, title, enable_functions) { $.post('/site?action=GetPHPVersion', function (rdata) { var php_version = ''; var n = 0; for (var i = rdata.length - 1; i >= 0; i--) { if (versions.indexOf(rdata[i].version) != -1) { php_version += "'; n++; } } if (n == 0) { layer.msg('Missing supported PHP version, please install!', { icon: 5, }); return; } var default_path = bt.get_cookie('sites_path'); if (!default_path) default_path = '/www/wwwroot'; var con = '
