Add dokuwiki module skeleton.

This commit is contained in:
Dominik Pantůček 2023-06-26 19:05:49 +02:00
parent c0040b3898
commit 000b57641d

60
src/dokuwiki.scm Normal file
View file

@ -0,0 +1,60 @@
;;
;; dokuwiki.scm
;;
;; Dokuwiki internals support.
;;
;; ISC License
;;
;; Copyright 2023 Dominik Pantůček <dominik.pantucek@trustica.cz>
;;
;; Permission to use, copy, modify, and/or distribute this software
;; for any purpose with or without fee is hereby granted, provided
;; that the above copyright notice and this permission notice appear
;; in all copies.
;;
;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
;; WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
;; WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
;; AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
;; CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
;; OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
;; NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
;; CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
;;
(declare (unit dokuwiki))
(module
dokuwiki
(
)
(import scheme
(chicken base)
(chicken pathname)
(chicken io)
racket-kwargs
configuration
util-parser)
;; Parses all dokuwiki users from current-input-port
(define (parse-dokuwiki-users-auth)
(let loop ((lines (read-lines))
(users '()))
(if (null? lines)
users
(let ((line (car lines)))
(loop (cdr lines)
users)))))
;; Parses all users from given filename
(define (load-dokuwiki-users-auth fname)
(with-input-from-file fname
parse-dokuwiki-users-auth))
;; Loads all users from default dokuwiki users database
(define* (dokuwiki-load-users (doku-base (*doku-base*)))
(load-dokuwiki-users-auth
(make-pathname doku-base "conf/users.auth.php")))
)