61 lines
No EOL
2 KiB
Bash
61 lines
No EOL
2 KiB
Bash
#!/bin/bash
|
|
#
|
|
# This script has been created as part of the Blueprint source code
|
|
# and uses the same license as the rest of the codebase.
|
|
|
|
|
|
# === DATABASE ===
|
|
FLDR=".blueprint/extensions/blueprint/private/db/database"
|
|
# dbAdd "database.record"
|
|
dbAdd() { echo "* ${1};" >> $FLDR; }
|
|
# dbValidate "database.record"
|
|
dbValidate() { grep -Fxq "* ${1};" $FLDR > /dev/null; }
|
|
# dbRemove "database.record"
|
|
dbRemove() { sed -i "s/* ${1};//g" $FLDR > /dev/null; }
|
|
|
|
|
|
# === TELEMETRY ===
|
|
sendTelemetry() {
|
|
cd "${BLUEPRINT__FOLDER}" || return
|
|
key=$(cat .blueprint/extensions/blueprint/private/db/telemetry_id)
|
|
if [[ $key == "KEY_NOT_UPDATED" ]]; then
|
|
return 0
|
|
fi
|
|
curl --location --silent --connect-timeout 3 "http://api.blueprint.zip:50000/send/$key/$1" &
|
|
}
|
|
|
|
|
|
# === CACHEREMINDER ===
|
|
updateCacheReminder() {
|
|
cd "${BLUEPRINT__FOLDER}" || return
|
|
# Overwrite previous adminCacheReminderHider with the default one.
|
|
oldClassName=$(cat .blueprint/extensions/blueprint/private/db/randomclassname)
|
|
newClassName=$RANDOM$RANDOM$RANDOM$RANDOM
|
|
mv .blueprint/extensions/blueprint/assets/misc/cacheOverlay-"${oldClassName}".css .blueprint/extensions/blueprint/assets/misc/cacheOverlay-"${newClassName}".css
|
|
sed -i "s~cacheOverlay-$oldClassName~cacheOverlay-$newClassName~g" .blueprint/extensions/blueprint/assets/blueprint.style.css
|
|
sed -i "s~I0TWHOPKAB-$oldClassName~I0TWHOPKAB-$newClassName~g" resources/views/blueprint/admin/admin.blade.php
|
|
sed -i "s~I0TWHOPKAB-$oldClassName~I0TWHOPKAB-$newClassName~g" .blueprint/extensions/blueprint/assets/misc/cacheOverlay-"${newClassName}".css
|
|
echo "$newClassName" > .blueprint/extensions/blueprint/private/db/randomclassname
|
|
}
|
|
|
|
|
|
# === SHIFTARGS ===
|
|
shiftArgs() {
|
|
shift 1
|
|
args=""
|
|
for arg in "$@"; do
|
|
args+="$arg "
|
|
done
|
|
echo "$args"
|
|
}
|
|
|
|
|
|
# === UNSETVARS ===
|
|
unsetVariables() {
|
|
patterns=("^conf_" "^old_" "^Console_" "^OldConsole_" "^Components_" "^OldComponents_" "^F_")
|
|
for pattern in "${patterns[@]}"; do
|
|
for var in $(compgen -v | grep "$pattern"); do
|
|
unset "$var"
|
|
done
|
|
done
|
|
} |