webbuild: create webbuild.db if missing
This commit is contained in:
parent
13407f5e51
commit
3717880b21
@ -53,7 +53,6 @@ if [ "$USER" ]; then
|
||||
if [ $? -eq 0 ]; then
|
||||
USER_ENABLED=1
|
||||
else
|
||||
echo "SECRET=$SECRET" >&2
|
||||
USER_ENABLED=
|
||||
fi
|
||||
elif [ "${REQUEST:0:7}" != "refresh" ]; then
|
||||
@ -199,7 +198,7 @@ if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshsocial" -o ! "$USER" ]; then
|
||||
if [ "$WEBBUILD_URL" -a "${WEBBUILD_URL/\/localhost\//}" = "$WEBBUILD_URL" ]; then
|
||||
curl -s "$WEBBUILD_URL?REQUEST=refreshsocial&USER=$USER&SECRET=`cgi_encodevar \"$USER_SECRET\"`&USER_EMAIL=$USER_EMAIL&FROMID=$FROMID"
|
||||
else
|
||||
[ -e "$WEBBUILD_STATEDIR/webbuild.db" ] || exit
|
||||
[ -e "$WEBBUILD_STATEDIR/webbuild.db" ] || create_webbuild_db
|
||||
# social box
|
||||
echo -n "<socialbox>"
|
||||
SID=0
|
||||
|
@ -25,6 +25,11 @@ function set_user_state_var() {
|
||||
[ "$statevalue" ] && echo "$statevar=$statevalue" >> $WEBBUILD_STATEDIR/users/$stateuser.state
|
||||
}
|
||||
|
||||
function create_webbuild_db() {
|
||||
sqlite3 $WEBBUILD_STATEDIR/webbuild.db \
|
||||
"CREATE TABLE social_log(id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, privacy BOOLEAN, user CHAR(40), type CHAR(40), target CHAR(40), email CHAR(80), text TEXT, time datetime default current_timestamp);"
|
||||
}
|
||||
|
||||
function social_log() {
|
||||
local line=$1
|
||||
local SPRIVACY=0
|
||||
@ -34,8 +39,7 @@ function social_log() {
|
||||
if [ ! "$STATE_FAKEUSER" ]; then
|
||||
|
||||
[ -e $WEBBUILD_STATEDIR/webbuild.db ] || \
|
||||
sqlite3 $WEBBUILD_STATEDIR/webbuild.db \
|
||||
"CREATE TABLE social_log(id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, privacy BOOLEAN, user CHAR(40), type CHAR(40), target CHAR(40), email CHAR(80), text TEXT, time datetime default current_timestamp);"
|
||||
creaqte_webbuild_db
|
||||
|
||||
eval "$line"
|
||||
[ "$STATE_PRIVACYMODE" ] && $SPRIVACY=1
|
||||
|
Loading…
Reference in New Issue
Block a user