#!/bin/sh

# Codebase installation script accompanies wwwsync to help install 
# of codebase enabled sites.
# Quinn Comendant <quinn@strangecode.com> 25 Dec 2004 

sitebase=`expr $0 : "\(.*\)/codebase/bin/install.sh"`;

# Ensure log directory exists and is writable.
if [ ! -d "$sitebase/log" ]; then
    mkdir "$sitebase/log";
fi
chmod 777 "$sitebase/log";

# If old log locations exists, copy to new directory.
if [ -f "$sitebase/codebase/logs/app_error_log" ] || [ -f "$sitebase/codebase/logs/php_error_log" ]; then
    echo "Moving logs to new log directory: $sitebase/log/";
    mv -v --backup "$sitebase/codebase/logs/*" "$sitebase/log/";
fi

# Write site install date.
echo `date '+%Y-%m-%d %H:%M:%S'` >> "$sitebase/wwwsynclog";
