(module hwiki mzscheme
(require (planet "hwikireq.scm" ("oesterholt" "hwiki.plt" 1 0)))
(require (planet "hwiki-internal.scm" ("oesterholt" "hwiki.plt" 1 0)))
(require (planet "hwiki-manager.scm" ("oesterholt" "hwiki.plt" 1 0)))
(require (planet "config.scm" ("oesterholt" "hwiki.plt" 1 0)))
(provide interface-version
instance-expiration-handler
manager
start)
(require (prefix sqli: (file "../../hwiki-sqli.scm")))
(set-sqli-provider! sqli:sqli-provider)
(require (file "../../hwiki-plugins.scm"))
(define interface-version 'v2-transitional)
(define (instance-expiration-handler failed-request)
(display (format "~s~%" failed-request))
)
(define manager (hwiki-current-manager
(create-hwiki-manager instance-expiration-handler)))
(define (start request)
(hwiki-start request))
(if (not (getenv "HWIKI_TINYMCE"))
(error "The location of the 'tinymce' directory must be given through environment variable HWIKI_TINYMCE"))
(if (not (getenv "HWIKI_PLUGINS"))
(error "The location of 'hwiki-plugins.scm' must be given through environment variable HWIKI_PLUGINS"))
(if (not (getenv "HWIKI_DATA"))
(error "The hwiki data directory must be given through environment variable HWIKI_DATA"))
(if (not (getenv "HWIKI_HTDOCS"))
(error "The htdocs directory must be given through environment variable HWIKI_HTDOCS"))
(if (not (getenv "HWIKI_LOGS"))
(error "The hwiki logs directory must be given through environment variable HWIKI_LOGS"))
(if (not (getenv "HWIKI_SRCDIR"))
(error "The hwiki source directory must be given through environment variable HWIKI_SRCDIR"))
(let ((src (getenv "HWIKI_TINYMCE"))
(dst (build-path (getenv "HWIKI_HTDOCS") "tinymce")))
(if (not (directory-exists? dst))
(copy-directory/files src dst)))
(let ((src (getenv "HWIKI_PLUGINS"))
(dst (build-path (current-directory) "hwiki-plugins.scm")))
(if (not (file-exists? dst))
(copy-to src dst)))
(let ((src (getenv "HWIKI_REWRITES"))
(dst (build-path (current-directory) "rewrite-rules.scm")))
(if (file-exists? src)
(if (not (file-exists? dst))
(copy-to src dst))))
(let ((srcdir (build-path (getenv "HWIKI_SRCDIR") "examples"))
(dstdir (build-path (getenv "HWIKI_DATA") "css"))
(htdocd (build-path (getenv "HWIKI_HTDOCS"))))
(if (not (directory-exists? dstdir))
(make-directory* dstdir))
(if (not (directory-exists? htdocd))
(make-directory* htdocd))
(if (not (file-exists? (build-path dstdir "admin")))
(begin
(copy-to (build-path srcdir "admin") (build-path dstdir "admin"))
(copy-to (build-path srcdir "admin") (build-path htdocd "admin.css"))))
(if (not (file-exists? (build-path dstdir "default")))
(begin
(copy-to (build-path srcdir "default") (build-path dstdir "default"))
(copy-to (build-path srcdir "default") (build-path htdocd "default.css"))))
)
)