forked from github/server
move php calls from python to shell script
This commit is contained in:
parent
32da0028c1
commit
85a7066ecc
2 changed files with 24 additions and 13 deletions
|
@ -55,9 +55,6 @@ sendmail = True
|
|||
maxfiles = 30
|
||||
# write headers to file?
|
||||
writeheaders = True
|
||||
# write received files to database?
|
||||
tooldir = os.path.join(rootdir, 'orders-php')
|
||||
writedb = os.path.exists(tooldir)
|
||||
# reject all html email?
|
||||
rejecthtml = True
|
||||
|
||||
|
@ -306,11 +303,8 @@ def accept(game, locale, stream, extend=None):
|
|||
warning = " (" + messages["warning-" + locale] + ")"
|
||||
msg = msg + formatpar(messages["nodate-" + locale], 76, 2) + "\n"
|
||||
|
||||
if writedb:
|
||||
dirname, basename = os.path.split(filename)
|
||||
cli = os.path.join(tooldir, 'cli.php');
|
||||
dbname = os.path.join(dirname, 'orders.db')
|
||||
subprocess.call(['php', cli, '-d', dbname, 'insert', basename, email])
|
||||
print('ACCEPT_MAIL=' + email)
|
||||
print('ACCEPT_FILE="' + filename + '"')
|
||||
|
||||
if not text_ok:
|
||||
warning = " (" + messages["error-" + locale] + ")"
|
||||
|
|
|
@ -1,8 +1,25 @@
|
|||
#!/bin/sh
|
||||
SCRIPT=$(readlink -f $0)
|
||||
cd $(dirname $SCRIPT)
|
||||
# example: orders-accept 2 de < mail.txt
|
||||
|
||||
lockfile -r3 -l120 orders.queue.lock
|
||||
python accept-orders.py "$@"
|
||||
rm -f orders.queue.lock
|
||||
game="$1"
|
||||
|
||||
[ -z "$ERESSEA" ] && ERESSEA="$HOME/eressea"
|
||||
SCRIPT=$(readlink -f "$0")
|
||||
BIN=$(dirname "$SCRIPT")
|
||||
|
||||
LOCKFILE="$ERESSEA/game-$game/orders.queue.lock"
|
||||
set -e
|
||||
trap 'rm -f "$LOCKFILE"' EXIT
|
||||
|
||||
cd "$ERESSEA/game-$game"
|
||||
mkdir -p orders.dir
|
||||
cd orders.dir
|
||||
lockfile -r3 -l120 "$LOCKFILE"
|
||||
eval "$(python "$BIN/accept-orders.py" "$@")"
|
||||
filename=$(basename "$ACCEPT_FILE")
|
||||
email="$ACCEPT_MAIL"
|
||||
if [ -d "$ERESSEA/orders-php" ]
|
||||
then
|
||||
php "$ERESSEA/orders-php/cli.php" insert "$filename" "$email"
|
||||
fi
|
||||
rm -f "$LOCKFILE"
|
||||
|
|
Loading…
Reference in a new issue