pull/109/head
midoks 6 years ago
parent df84e3f86c
commit 93f5579807
  1. 6
      plugins/php/index.py
  2. 44
      plugins/php/js/php.js
  3. 28
      plugins/simdht/workers/simdht_worker.py

@ -525,6 +525,10 @@ def getLibConf(version):
libs.append(lib) libs.append(lib)
return public.returnJson(True, 'OK!', libs) return public.returnJson(True, 'OK!', libs)
def installLib(version):
return version, 'ok'
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv) < 3: if len(sys.argv) < 3:
@ -574,5 +578,7 @@ if __name__ == "__main__":
print getPhpinfo(version) print getPhpinfo(version)
elif func == 'get_lib_conf': elif func == 'get_lib_conf':
print getLibConf(version) print getLibConf(version)
elif func == 'install_lib':
print installLib(version)
else: else:
print "fail" print "fail"

@ -383,24 +383,22 @@ function getPHPInfo(version) {
function phpLibConfig(version){ function phpLibConfig(version){
phpPost('get_lib_conf', version, '', function(data){ phpPost('get_lib_conf', version, '', function(data){
console.log(data);
var rdata = $.parseJSON(data.data);
console.log(rdata.data);
var rdata = $.parseJSON(data.data);
var libs = rdata.data; var libs = rdata.data;
var body = "" var body = "";
var opt = "" var opt = "";
for (var i = 0; i < libs.length; i++) { for (var i = 0; i < libs.length; i++) {
if (libs[i].versions.indexOf(version) == -1) continue; if (libs[i].versions.indexOf(version) == -1) continue;
if (libs[i]['task'] == '-1' && libs[i].phpversions.indexOf(version) != -1) { if (libs[i]['task'] == '-1' && libs[i].phpversions.indexOf(version) != -1) {
opt = '<a style="color:green;" href="javascript:messageBox();">' + lan.soft.the_install + '</a>' opt = '<a style="color:green;" href="javascript:messageBox();">安装</a>'
} else if (libs[i]['task'] == '0' && libs[i].phpversions.indexOf(version) != -1) { } else if (libs[i]['task'] == '0' && libs[i].phpversions.indexOf(version) != -1) {
opt = '<a style="color:#C0C0C0;" href="javascript:messageBox();">' + lan.soft.sleep_install + '</a>' opt = '<a style="color:#C0C0C0;" href="javascript:messageBox();">等待安装...</a>'
} else if (libs[i].status) { } else if (libs[i].status) {
opt = '<a style="color:red;" href="javascript:UninstallPHPLib(\'' + version + '\',\'' + libs[i].name + '\',\'' + libs[i].title + '\',' + '' + ');">' + lan.soft.uninstall + '</a>' opt = '<a style="color:red;" href="javascript:uninstallPHPLib(\'' + version + '\',\'' + libs[i].name + '\',\'' + libs[i].title + '\',' + '' + ');">卸载</a>'
} else { } else {
opt = '<a class="btlink" href="javascript:InstallPHPLib(\'' + version + '\',\'' + libs[i].name + '\',\'' + libs[i].title + '\',' + '' + ');">' + lan.soft.install + '</a>' opt = '<a class="btlink" href="javascript:installPHPLib(\'' + version + '\',\'' + libs[i].name + '\',\'' + libs[i].title + '\',' + '' + ');">安装</a>'
} }
body += '<tr>' + body += '<tr>' +
@ -417,17 +415,21 @@ function phpLibConfig(version){
'<table class="table table-hover" width="100%" cellspacing="0" cellpadding="0" border="0">' + '<table class="table table-hover" width="100%" cellspacing="0" cellpadding="0" border="0">' +
'<thead>' + '<thead>' +
'<tr>' + '<tr>' +
'<th>' + lan.soft.php_ext_name + '</th>' + '<th>名称</th>' +
'<th width="64">' + lan.soft.php_ext_type + '</th>' + '<th width="64">类型</th>' +
'<th>' + lan.soft.php_ext_ps + '</th>' + '<th>说明</th>' +
'<th width="40">' + lan.soft.php_ext_status + '</th>' + '<th width="40">状态</th>' +
'<th style="text-align: right;" width="50">' + lan.public.action + '</th>' + '<th style="text-align: right;" width="50">操作</th>' +
'</tr>' + '</tr>' +
'</thead>' + '</thead>' +
'<tbody>' + body + '</tbody>' + '<tbody>' + body + '</tbody>' +
'</table>' + '</table>' +
'</div>' + '</div>' +
'<ul class="help-info-text c7 pull-left"><li>请按实际需求安装扩展,不要安装不必要的PHP扩展,这会影响PHP执行效率,甚至出现异常</li><li>Redis扩展只允许在1个PHP版本中使用,安装到其它PHP版本请在[软件管理]重装Redis</li><li>opcache/xcache/apc等脚本缓存扩展,请只安装其中1个,否则可能导致您的站点程序异常</li></ul>'; '<ul class="help-info-text c7 pull-left">\
<li>请按实际需求安装扩展,不要安装不必要的PHP扩展,这会影响PHP执行效率,甚至出现异常</li>\
<li>Redis扩展只允许在1个PHP版本中使用,安装到其它PHP版本请在[软件管理]重装Redis</li>\
<li>opcache/xcache/apc等脚本缓存扩展,请只安装其中1个,否则可能导致您的站点程序异常</li>\
</ul>';
$('.soft-man-con').html(con); $('.soft-man-con').html(con);
}); });
@ -516,11 +518,11 @@ function setPHPConfig(version, pathinfo, go) {
} }
//安装扩展 //安装扩展
function InstallPHPLib(version, name, title, pathinfo) { function installPHPLib(version, name, title, pathinfo) {
layer.confirm(lan.soft.php_ext_install_confirm.replace('{1}', name), { icon: 3, closeBtn: 2 }, function() { layer.confirm('您真的要安装{1}吗?'.replace('{1}', name), { icon: 3, closeBtn: 2 }, function() {
name = name.toLowerCase(); name = name.toLowerCase();
var data = "name=" + name + "&version=" + version + "&type=1"; var data = "name=" + name + "&version=" + version + "&type=1";
var loadT = layer.msg(lan.soft.add_install, { icon: 16, time: 0, shade: [0.3, '#000'] }); var loadT = layer.msg('正在添加到安装器...', { icon: 16, time: 0, shade: [0.3, '#000'] });
$.post('/files?action=InstallSoft', data, function(rdata) { $.post('/files?action=InstallSoft', data, function(rdata) {
setTimeout(function() { setTimeout(function() {
layer.close(loadT); layer.close(loadT);
@ -533,13 +535,13 @@ function InstallPHPLib(version, name, title, pathinfo) {
fly("bi-btn"); fly("bi-btn");
InstallTips(); InstallTips();
GetTaskCount(); getTaskCount();
}); });
} }
//卸载扩展 //卸载扩展
function UninstallPHPLib(version, name, title, pathinfo) { function uninstallPHPLib(version, name, title, pathinfo) {
layer.confirm(lan.soft.php_ext_uninstall_confirm.replace('{1}', name), { icon: 3, closeBtn: 2 }, function() { layer.confirm('您真的要安装{1}吗?'.replace('{1}', name), { icon: 3, closeBtn: 2 }, function() {
name = name.toLowerCase(); name = name.toLowerCase();
var data = 'name=' + name + '&version=' + version; var data = 'name=' + name + '&version=' + version;
var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] }); var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] });

@ -410,20 +410,6 @@ class Master(Thread):
self.queue.put([address, binhash, 'lt']) self.queue.put([address, binhash, 'lt'])
def announce(info_hash, address):
binhash = info_hash.decode('hex')
master.log_announce(binhash, address)
return 'ok'
def rpc_server():
rpcserver = SimpleXMLRPCServer.SimpleXMLRPCServer(
('localhost', 8004), logRequests=False)
rpcserver.register_function(announce, 'announce')
print 'Starting xml rpc server...'
rpcserver.serve_forever()
class DBCheck(Master): class DBCheck(Master):
def __init__(self, master): def __init__(self, master):
@ -467,6 +453,20 @@ class DBCheck(Master):
self.check_db_size() self.check_db_size()
time.sleep(DB_SIZE_TICK) time.sleep(DB_SIZE_TICK)
def announce(info_hash, address):
binhash = info_hash.decode('hex')
master.log_announce(binhash, address)
return 'ok'
def rpc_server():
rpcserver = SimpleXMLRPCServer.SimpleXMLRPCServer(
('localhost', 8004), logRequests=False)
rpcserver.register_function(announce, 'announce')
print 'Starting xml rpc server...'
rpcserver.serve_forever()
if __name__ == "__main__": if __name__ == "__main__":
# max_node_qsize bigger, bandwith bigger, spped higher # max_node_qsize bigger, bandwith bigger, spped higher
master = Master() master = Master()

Loading…
Cancel
Save