Avoid using PHP for the expired sites
[public/expire-sites.git] / generate-expire-config
index c590be2..aa41a92 100755 (executable)
@@ -3,8 +3,9 @@
 #
 # CONFIGURATION
 #
+LANG=C
 DISABLED_PAGE=/~sysadmin/expired/index.php
-
+WHITELIST="ctdalek"
 #
 # Temporary files
 #
@@ -28,7 +29,7 @@ if [ ${TERM_START_MONTH} -eq 1 ]; then
    fi
 elif [ ${TERM_START_MONTH} -eq 5 ]; then
    if [ ${MONTH} -eq 5 ]; then
-      TERM_FILTER="(!(term=W${YEAR}))(!(term=W${YEAR}))"
+      TERM_FILTER="(!(term=W${YEAR}))(!(term=S${YEAR}))"
    else
       TERM_FILTER="(!(term=S${YEAR}))"
    fi
@@ -50,11 +51,11 @@ ldapsearch -xb "ou=People,dc=csclub,dc=uwaterloo,dc=ca" "(&${TERM_FILTER}(object
 # Generate Apache config
 #
 for uid in $(cat ${EXPIRED_USERS}); do
-   if [ -d /users/${uid}/www ]; then
+   if [ -d /users/${uid}/www ] && [[ ! ${WHITELIST} =~ ${uid} ]]; then
       echo "<Directory /users/${uid}>"
       echo "    AllowOverride None"
-      echo "    RewriteEngine On"
-      echo "    RewriteRule . ${DISABLED_PAGE} [L]"
+      echo "    Redirect 503 /"
+      echo "    ErrorDocument 503 /~sysadmin/expired/index.html"
       echo "</Directory>"
       echo ""
    fi