Skip to content

Commit

Permalink
fix #3
Browse files Browse the repository at this point in the history
  • Loading branch information
jK committed Jun 25, 2013
1 parent a414b9b commit e0ce353
Showing 1 changed file with 33 additions and 19 deletions.
52 changes: 33 additions & 19 deletions buildbot/slave/wiki/mediawiki_upload.sh
Expand Up @@ -10,10 +10,6 @@ CONTENT=$5
WIKIAPI="http://springrts.com/mediawiki/api.php"
cookie_jar="wikicj"

if [ -f "$CONTENT" ]; then
CONTENT=`cat "$CONTENT"`
fi

#########################
# Login
echo "Logging into $WIKIAPI as $USERNAME..."
Expand Down Expand Up @@ -148,21 +144,39 @@ fi
#########################
# Upload

CR=$(curl -s \
--location \
--cookie $cookie_jar \
--cookie-jar $cookie_jar \
--user-agent "Curl Shell Script" \
--keepalive-time 60 \
--header "Accept-Language: en-us" \
--header "Connection: keep-alive" \
--header "Expect:" \
--form "title=$PAGE" \
--form "bot=1" \
--form "text=$CONTENT" \
--form "section=${SECTION_NUM-0}" \
--form "token=${EDITTOKEN}" \
--request "POST" "${WIKIAPI}?action=edit&format=txt&")
if [ -f "$CONTENT" ]; then
CR=$(curl -s \
--location \
--cookie $cookie_jar \
--cookie-jar $cookie_jar \
--user-agent "Curl Shell Script" \
--keepalive-time 60 \
--header "Accept-Language: en-us" \
--header "Connection: keep-alive" \
--header "Expect:" \
--form "title=$PAGE" \
--form "bot=1" \
--form "text=@$CONTENT" \
--form "section=${SECTION_NUM-0}" \
--form "token=${EDITTOKEN}" \
--request "POST" "${WIKIAPI}?action=edit&format=txt&")
else
CR=$(curl -s \
--location \
--cookie $cookie_jar \
--cookie-jar $cookie_jar \
--user-agent "Curl Shell Script" \
--keepalive-time 60 \
--header "Accept-Language: en-us" \
--header "Connection: keep-alive" \
--header "Expect:" \
--form "title=$PAGE" \
--form "bot=1" \
--form "text=$CONTENT" \
--form "section=${SECTION_NUM-0}" \
--form "token=${EDITTOKEN}" \
--request "POST" "${WIKIAPI}?action=edit&format=txt&")
fi

echo $CR

Expand Down

0 comments on commit e0ce353

Please sign in to comment.