# This file initializes common variables. # It is not meant to be executed directly # but will be sourced by other scripts. # Identify our plug-in base directory. PLUGIN_DIR=`dirname "$0"` PLUGIN_DIR=`readlink -f "$PLUGIN_DIR/../.."` # OJS directories OJS_DIR=`readlink -f "$PLUGIN_DIR/../../.."` OJS_FILES=`grep '^[[:space:]]*files_dir[[:space:]]*=' "$OJS_DIR/config.inc.php" | sed 's/^[[:space:]]*files_dir[[:space:]]*=\s*//;s/\s*$//'` if [ ! \( -d "$OJS_FILES" -a -w "$OJS_FILES" \) ]; then echo "We did not find the location of the OJS files directory or the files directory is not writable." exit 1 fi if [ ! -e "$OJS_FILES/lucene" ]; then mkdir "$OJS_FILES/lucene" fi # Set the path to the solr PID file. SOLR_PIDFILE="$OJS_FILES/lucene/solr.pid" # Try to guess the OJS base URL from its configuration file. URL_HOST_PATTERN='((([a-z0-9]([-a-z0-9]*[a-z0-9])?\.)*[a-z]([a-z0-9]+)?\.?)|([0-9]{1,3}(\.[0-9]{1,3}){3}))' URL_PORT_PATTERN='(:([0-9]*))?' URL_PATH_PATTERN=$'((/(%[0-9a-f]{2}|[-a-z0-9_.!~*\\\'():@\\&=+$,;])*)*/?)?' URL_PATTERN="https?://(${URL_HOST_PATTERN}${URL_PORT_PATTERN})${URL_PATH_PATTERN}" OJS_BASE_URL=`grep '^\s*base_url' "$OJS_DIR/config.inc.php" | sed $'s/^[^=]*=\s*//;s/[\'"]//g' | egrep -i "$URL_PATTERN"`