pull/109/head
Mr Chen 6 years ago
parent 5d5abbe3b8
commit 9809a6e880
  1. 2
      class/core/plugins_api.py
  2. 2
      class/core/public.py
  3. 18
      plugins/php/index.py
  4. 122
      plugins/php/versions/56/yaf.sh

@ -48,7 +48,7 @@ class plugins_api:
def listApi(self): def listApi(self):
sType = request.args.get('type', '0') sType = request.args.get('type', '0')
sPage = request.args.get('p', '1') sPage = request.args.get('p', '1')
print sPage # print sPage
data = self.getPluginList(sType, int(sPage)) data = self.getPluginList(sType, int(sPage))
return public.getJson(data) return public.getJson(data)

@ -310,7 +310,7 @@ def httpGet(url, timeout=30):
response = urllib2.urlopen(url, timeout=timeout) response = urllib2.urlopen(url, timeout=timeout)
return response.read() return response.read()
except Exception, ex: except Exception, ex:
# WriteLog('网络诊断',str(ex) + '['+url+']'); # writeLog('网络诊断', str(ex) + '[' + url + ']')
return str(ex) return str(ex)

@ -495,11 +495,12 @@ def checkPhpinfoFile(version):
def getPhpinfo(version): def getPhpinfo(version):
checkPhpinfoFile(version) checkPhpinfoFile(version)
sPath = public.getRootDir() + '/phpinfo/' + version sPath = public.getRootDir() + '/phpinfo/' + version
public.execShell("rm -rf " + public.getRootDir() + '/phpinfo') # public.execShell("rm -rf " + public.getRootDir() + '/phpinfo')
public.execShell("mkdir -p " + sPath) public.execShell("mkdir -p " + sPath)
public.writeFile(sPath + '/phpinfo.php', '<?php phpinfo(); ?>') public.writeFile(sPath + '/phpinfo.php', '<?php phpinfo(); ?>')
phpinfo = public.httpGet('http://127.0.0.1/' + version + '/phpinfo.php') # print 'http://127.0.0.1/' + version + '/phpinfo.php'
os.system("rm -rf " + public.getRootDir() + '/phpinfo') phpinfo = public.httpGet('http://127.0.0.1/' + version + '/phpinfo.php', 3)
# os.system("rm -rf " + public.getRootDir() + '/phpinfo')
return phpinfo return phpinfo
@ -547,11 +548,16 @@ def installLib(version):
name + '.sh' + " " + stype + " " + version name + '.sh' + " " + stype + " " + version
rettime = time.strftime('%Y-%m-%d %H:%M:%S') rettime = time.strftime('%Y-%m-%d %H:%M:%S')
public.M('tasks').add('id,name,type,status,addtime,execstr', (None, insert_info = (None, '安装[' + name + '-' + version + ']',
'安装[' + name + '-' + version + ']', 'execshell', '0', rettime, execstr)) 'execshell', '0', rettime, execstr)
public.M('tasks').add('id,name,type,status,addtime,execstr', insert_info)
# print execstr # print execstr
return public.returnJson(True, '已将下载任务添加到队列!') return public.returnJson(True, '已将下载任务添加到队列!')
def uninstallLib(version):
return 'ok'
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv) < 3: if len(sys.argv) < 3:
@ -603,5 +609,7 @@ if __name__ == "__main__":
print getLibConf(version) print getLibConf(version)
elif func == 'install_lib': elif func == 'install_lib':
print installLib(version) print installLib(version)
elif func == 'uninstall_lib':
print uninstallLib(version)
else: else:
print "fail" print "fail"

@ -0,0 +1,122 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
Install_yaf()
{
case "${version}" in
'54')
extFile='/www/server/php/54/lib/php/extensions/no-debug-non-zts-20100525/yaf.so'
;;
'55')
extFile='/www/server/php/55/lib/php/extensions/no-debug-non-zts-20121212/yaf.so'
;;
'56')
extFile='/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/yaf.so'
;;
'70')
extFile='/www/server/php/70/lib/php/extensions/no-debug-non-zts-20151012/yaf.so'
;;
'71')
extFile='/www/server/php/71/lib/php/extensions/no-debug-non-zts-20160303/yaf.so'
;;
'71')
extFile='/www/server/php/71/lib/php/extensions/no-debug-non-zts-20160303/yaf.so'
;;
'72')
extFile='/www/server/php/72/lib/php/extensions/no-debug-non-zts-20170718/yaf.so'
;;
esac
isInstall=`cat /www/server/php/$version/etc/php.ini|grep 'yaf.so'`
if [ "${isInstall}" != "" ];then
echo "php-$vphp 已安装yaf,请选择其它版本!"
return
fi
if [ ! -f "$extFile" ];then
public_file=/www/server/panel/install/public.sh
if [ ! -f $public_file ];then
wget -O $public_file http://download.bt.cn/install/public.sh -T 5;
fi
. $public_file
download_Url=$NODE_URL
wafV='2.3.5';
if [ "$version" = '70' ] || [ "$version" = '71' ] || [ "$version" = '72' ];then
wafV='3.0.7';
fi
wget -O yaf-$wafV.tgz $download_Url/src/yaf-$wafV.tgz
tar xvf yaf-$wafV.tgz
cd yaf-$wafV
/www/server/php/$version/bin/phpize
./configure --with-php-config=/www/server/php/$version/bin/php-config
make && make install
cd ..
rm -rf yaf-*
rm -f package.xml
fi
if [ ! -f "$extFile" ];then
echo "ERROR!"
return;
fi
echo "extension=$extFile" >> /www/server/php/$version/etc/php.ini
service php-fpm-$version reload
echo '==========================================================='
echo 'successful!'
}
Uninstall_yaf()
{
if [ ! -f "/www/server/php/$version/bin/php-config" ];then
echo "php-$vphp 未安装,请选择其它版本!"
return
fi
case "${version}" in
'54')
extFile='/www/server/php/54/lib/php/extensions/no-debug-non-zts-20100525/yaf.so'
;;
'55')
extFile='/www/server/php/55/lib/php/extensions/no-debug-non-zts-20121212/yaf.so'
;;
'56')
extFile='/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/yaf.so'
;;
'70')
extFile='/www/server/php/70/lib/php/extensions/no-debug-non-zts-20151012/yaf.so'
;;
'71')
extFile='/www/server/php/71/lib/php/extensions/no-debug-non-zts-20160303/yaf.so'
;;
'72')
extFile='/www/server/php/72/lib/php/extensions/no-debug-non-zts-20170718/yaf.so'
esac
if [ ! -f "$extFile" ];then
echo "php-$vphp 未安装yaf,请选择其它版本!"
return
fi
sed -i '/yaf.so/d' /www/server/php/$version/etc/php.ini
rm -f $extFile
/etc/init.d/php-fpm-$version reload
echo '==============================================='
echo 'successful!'
}
actionType=$1
version=$2
vphp=${version:0:1}.${version:1:1}
if [ "$actionType" == 'install' ];then
Install_yaf
elif [ "$actionType" == 'uninstall' ];then
Uninstall_yaf
fi
Loading…
Cancel
Save