Directory structure:
/Users/tld/Sites/dms/ # base directory
README # this file
page.php # web interface functions
database.php # database functions
configure.php # configuration parameters
bin/load.csh # shell script - initializes the system
words.csh # shell script - called by database.php
terms.pl # Perl script - called by words.csh
dict/lower-case-words.txt # words in Webster's 2nd edition
stop-words.txt # words like 'the', 'this', etc.
images/ # GIF and JPEG files
java/ # Java scripts - used in page.php
sql/dms.sql # SQL script - called by load.csh
pswds.sql # SQL script - called by load.csh
users/ # stores all user specific files
tld/entered-words.txt # all words seen by 'tld' so far
lpk/entered-words.txt # all words seen by 'lpk' so far
File and directory permissions:
www # Apache Web Server belongs to this group
This shell script makes the above structure explicit.
#!/bin/csh
# Variables used in this script:
set base=~tld/Sites
# Change to the base directory.
chdir $base
# Create the directory structure.
# Create the first-level directory.
/bin/mkdir $base/dms
# Create all second-level directories.
/bin/mkdir $base/dms/bin \
$base/dms/dict \
$base/dms/images \
$base/dms/java \
$base/dms/sql \
$base/dms/users
# The list of registered users:
set usrs=(\
tld \
lpk \
)
foreach usr ( $usrs )
/bin/mkdir $base/dms/users/$usr/
end
# Change the group of all files and directories to www.
# You need to be root or in www for the following to work.
/usr/bin/chgrp -R www dms
# Set all file permissions: user = rwx, group = rwx, other = r--
find . -type f -exec chmod 774 {} \;
# Set directory permissions: user = rwx, group = rwx, other = r-x
find . -type d -exec chmod 775 {} \;