瀏覽代碼

Convert setup.py to setup.sh for php-lithium

Lita Gratrix 10 年之前
父節點
當前提交
4b9fd2aa02
共有 3 個文件被更改,包括 12 次插入32 次删除
  1. 2 1
      frameworks/PHP/php-lithium/bash_profile.sh
  2. 0 31
      frameworks/PHP/php-lithium/setup.py
  3. 10 0
      frameworks/PHP/php-lithium/setup.sh

+ 2 - 1
frameworks/PHP/php-lithium/bash_profile.sh

@@ -4,4 +4,5 @@ export PHP_HOME=${IROOT}/php-5.5.17
 
 export PHP_FPM=$PHP_HOME/sbin/php-fpm
 
-export PATH="$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"
+export NGINX_HOME=${IROOT}/nginx
+

+ 0 - 31
frameworks/PHP/php-lithium/setup.py

@@ -1,31 +0,0 @@
-import subprocess
-import sys
-import os
-import setup_util
-
-def start(args, logfile, errfile):
-  setup_util.replace_text("php-lithium/app/config/bootstrap/connections.php", "192.168.100.102", ""+ args.database_host +"")
-  setup_util.replace_text("php-lithium/deploy/nginx.conf", "root .*\/FrameworkBenchmarks/php-lithium", "root " + args.troot)
-
-  try:
-    if os.name == 'nt':
-      subprocess.check_call('icacls "C:\\FrameworkBenchmarks\\php-lithium" /grant "IIS_IUSRS:(OI)(CI)F"', shell=True, stderr=errfile, stdout=logfile)
-      subprocess.check_call('appcmd add site /name:PHP /bindings:http/*:8080: /physicalPath:"C:\\FrameworkBenchmarks\\php-lithium"', shell=True, stderr=errfile, stdout=logfile)
-      return 0
-    subprocess.check_call("sudo chown -R www-data:www-data php-lithium", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo $PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/deploy/nginx.conf", shell=True, stderr=errfile, stdout=logfile)
-    return 0
-  except subprocess.CalledProcessError:
-    return 1
-def stop(logfile, errfile):
-  try:
-    if os.name == 'nt':
-      subprocess.call('appcmd delete site PHP', shell=True, stderr=errfile, stdout=logfile)
-      return 0
-    subprocess.call("sudo /usr/local/nginx/sbin/nginx -s stop", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.call("sudo kill -QUIT $( cat $TROOT/deploy/php-fpm.pid )", shell=True, stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo chown -R $USER:$USER php-lithium", shell=True, stderr=errfile, stdout=logfile)
-    return 0
-  except subprocess.CalledProcessError:
-    return 1

+ 10 - 0
frameworks/PHP/php-lithium/setup.sh

@@ -0,0 +1,10 @@
+#!/bin/bash
+
+sed -i 's|192.168.100.102|'"${DBHOST}"'|g' app/config/bootstrap/connections.php
+sed -i 's|root .*/FrameworkBenchmarks/php-lithium|root '"${TROOT}"'|g' deploy/nginx.conf
+sed -i 's|/usr/local/nginx/|'"${IROOT}"'/nginx/|g' deploy/nginx.conf
+
+export PATH="$PHP_HOME/bin:$PHP_HOME/sbin:$PATH"
+
+$PHP_FPM --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid
+$NGINX_HOME/sbin/nginx -c $TROOT/deploy/nginx.conf