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
|
maxfiles = 30
|
||||||
# write headers to file?
|
# write headers to file?
|
||||||
writeheaders = True
|
writeheaders = True
|
||||||
# write received files to database?
|
|
||||||
tooldir = os.path.join(rootdir, 'orders-php')
|
|
||||||
writedb = os.path.exists(tooldir)
|
|
||||||
# reject all html email?
|
# reject all html email?
|
||||||
rejecthtml = True
|
rejecthtml = True
|
||||||
|
|
||||||
|
@ -306,11 +303,8 @@ def accept(game, locale, stream, extend=None):
|
||||||
warning = " (" + messages["warning-" + locale] + ")"
|
warning = " (" + messages["warning-" + locale] + ")"
|
||||||
msg = msg + formatpar(messages["nodate-" + locale], 76, 2) + "\n"
|
msg = msg + formatpar(messages["nodate-" + locale], 76, 2) + "\n"
|
||||||
|
|
||||||
if writedb:
|
print('ACCEPT_MAIL=' + email)
|
||||||
dirname, basename = os.path.split(filename)
|
print('ACCEPT_FILE="' + filename + '"')
|
||||||
cli = os.path.join(tooldir, 'cli.php');
|
|
||||||
dbname = os.path.join(dirname, 'orders.db')
|
|
||||||
subprocess.call(['php', cli, '-d', dbname, 'insert', basename, email])
|
|
||||||
|
|
||||||
if not text_ok:
|
if not text_ok:
|
||||||
warning = " (" + messages["error-" + locale] + ")"
|
warning = " (" + messages["error-" + locale] + ")"
|
||||||
|
|
|
@ -1,8 +1,25 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
SCRIPT=$(readlink -f $0)
|
# example: orders-accept 2 de < mail.txt
|
||||||
cd $(dirname $SCRIPT)
|
|
||||||
|
|
||||||
lockfile -r3 -l120 orders.queue.lock
|
game="$1"
|
||||||
python accept-orders.py "$@"
|
|
||||||
rm -f orders.queue.lock
|
|
||||||
|
|
||||||
|
[ -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