Skip to content
Browse files

Got rid of permadelete

  • Loading branch information...
1 parent cff840a commit 421e1e0a773cc1bc7b8ddacc095a4940ec3dbe4f @vsedach committed Oct 10, 2012
Showing with 1 addition and 43 deletions.
  1. +0 −9 src/article.lisp
  2. +1 −8 src/dispatcher.lisp
  3. +0 −26 src/wiki.lisp
View
9 src/article.lisp
@@ -162,12 +162,3 @@
(unless (or (youre-banned?) (deleted? article))
(add-revision article "" "Deleted article" :revision-delete t))
(article-link title)))
-
-(defhandler /site/permadelete (title)
- (let ((article (find-article title :error t)))
- (awhen (and article
- (deleted? article)
- (not (youre-banned?))
- (account-admin *account*))
- (permadelete title)))
- #/)
View
9 src/dispatcher.lisp
@@ -9,14 +9,7 @@
404
*footer*
(with-output-to-string (*html-stream*)
- #H[<li><a href="$(#/site/history?article={ (article-title article) })">History</a></li>]
- (when (and (not (youre-banned?)) (account-admin *account*))
- #H[<li>
- <form method="post"
- action="$(#/site/permadelete?title={ (article-title article) })">
- <input class="del" type="submit" value="Delete permanently" />
- </form>
- </li>])))
+ #H[<li><a href="$(#/site/history?article={ (article-title article) })">History</a></li>]))
#H[Article was deleted])
(defun render-article (article)
View
26 src/wiki.lisp
@@ -150,32 +150,6 @@
obj)))))
obj)
-(defun permadelete (title)
- (let ((title (canonicalize title)))
- (with-lock-held ((update-lock *wiki*))
- (let ((article-revisions (revisions (find-article title))))
- (flet ((remove-article-revisions (list)
- (remove-if (lambda (x)
- (member x article-revisions))
- list)))
- (with-lock-held ((index-lock *wiki*))
- (setf (recent-changes *wiki*) (remove-article-revisions
- (recent-changes *wiki*)))
- ;; topic and search index should be clear,
- ;; but need to clear out author-index
- (loop for x being the hash-key of (author-index *wiki*)
- using (hash-value old-rs) do
- (setf (gethash x (author-index *wiki*))
- (remove-article-revisions old-rs))))))
- (with-lock-held ((data-lock *wiki*))
- (remhash title (articles *wiki*)))
- (let* ((esc-title (uri-encode title))
- (deleted-path (wiki-path #?"deleted-articles/${ esc-title }/")))
- ;; rename-file sucks balls if file exists
- (cl-fad:delete-directory-and-files deleted-path :if-does-not-exist :ignore)
- (rename-file (wiki-path #?"articles/${ esc-title }/")
- (ensure-directories-exist deleted-path))))))
-
;;; update
(defmacro update-account (account &rest updates)

0 comments on commit 421e1e0

Please sign in to comment.
Something went wrong with that request. Please try again.