<commit_before>#!/bin/bash

# This is a little convenience script which sets / fixes the permissions of the Data
# and the Web directory. This script will disappear as soon as we have some proper
# installation routine in place.
#
# Make sure to set the webserver group name to the one used by your system.

echo FLOW3 File Permission Script

if [ ! -d "Web" -o ! -d "Packages" -o ! -d "Configuration" ]; then
	echo
	echo Make sure you run this from the FLOW3 root directory!
	echo
	exit 1
fi

if [ "$#" != "3" ]; then
	echo
	echo "Usage: ./flow3 core:setfilepermissions <commandlineuser> <webuser> <webgroup>"
	echo "Run as super user, if needed (probably)"
	echo
	exit 1
fi

COMMANDLINE_USER="$1"
WEBSERVER_USER="$2"
WEBSERVER_GROUP="$3"

echo "(if a password prompt appears, it's from sudo)"
echo
echo "Checking permissions from here upwards."

unset PARENT_PATH
PARENT_PATH_PARTS=$(pwd | awk 'BEGIN{FS="/"}{for (i=1; i < NF; i++) print $i}')
for PARENT_PATH_PART in $PARENT_PATH_PARTS ; do
	PARENT_PATH="$PARENT_PATH/$PARENT_PATH_PART"
	sudo -u $WEBSERVER_USER test -x "$PARENT_PATH"
	if [ $? -gt 0 ]; then
		echo "  $PARENT_PATH seems NOT to be searchable (executable) for user $WEBSERVER_USER!"
		echo "  Sorry, you need to fix this yourself if it's a problem, I don't know your preferred permissions ..."
	fi
done

echo "Making sure Data and Web/_Resources exist."
sudo mkdir -p Data
sudo mkdir -p Web/_Resources

sudo rm -rf Data/Temporary/*

echo "Setting file permissions, trying to set ACLs via chmod ..."
<commit_msg>[BUGFIX] setfilepermissions does not use sudo anymore<commit_after>#!/bin/bash

# This is a little convenience script which sets / fixes the permissions of the Data
# and the Web directory. This script will disappear as soon as we have some proper
# installation routine in place.
#
# Make sure to set the webserver group name to the one used by your system.

echo FLOW3 File Permission Script
echo

if [ ! -d "Web" -o ! -d "Packages" -o ! -d "Configuration" ]; then
	echo Make sure you run this from the FLOW3 root directory!
	echo
	exit 1
fi

if [ "$#" != "3" ]; then
	echo "Usage: ./flow3 core:setfilepermissions <commandlineuser> <webuser> <webgroup>"
	echo "Run as super user."
	echo
	exit 1
fi

if [ "$(id -u)" != "0" ]; then
   echo "This command must be called as super user. Use 'sudo' or run as root." 1>&2
	echo
   exit 1
fi

COMMANDLINE_USER="$1"
WEBSERVER_USER="$2"
WEBSERVER_GROUP="$3"

echo "Checking permissions from here upwards."

unset PARENT_PATH
PARENT_PATH_PARTS=$(pwd | awk 'BEGIN{FS="/"}{for (i=1; i < NF; i++) print $i}')
for PARENT_PATH_PART in $PARENT_PATH_PARTS ; do
	PARENT_PATH="$PARENT_PATH/$PARENT_PATH_PART"
	sudo -u $WEBSERVER_USER test -x "$PARENT_PATH"
	if [ $? -gt 0 ]; then
		echo "  $PARENT_PATH seems NOT to be searchable (executable) for user $WEBSERVER_USER!"
		echo "  Sorry, you need to fix this yourself if it's a problem, I don't know your preferred permissions ..."
	fi
done

echo "Making sure Data and Web/_Resources exist."
sudo mkdir -p Data
sudo mkdir -p Web/_Resources

sudo rm -rf Data/Temporary/*

echo "Setting file permissions, trying to set ACLs via chmod ..."

{'fraction_non_alphanumeric': 0.10645058786145535, 'fraction_numerical': 0.008261836669844296, 'mean_word_length': 4.052969502407705, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4764720', 'n_tokens_mistral': 1109, 'n_tokens_neox': 1040, 'n_words': 435}