From 5a7af0f08323a83063476c5c1bfca1725fb33899 Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 8 Dec 2019 15:29:02 +0000 Subject: [PATCH] remove delete-by-query - bulk actions does the same thing better --- ext/admin/main.php | 31 ------------------------------- ext/admin/theme.php | 24 ------------------------ 2 files changed, 55 deletions(-) diff --git a/ext/admin/main.php b/ext/admin/main.php index 03d4d354..50781f28 100644 --- a/ext/admin/main.php +++ b/ext/admin/main.php @@ -134,37 +134,6 @@ class AdminPage extends Extension } } - // public function onPostListBuilding(PostListBuildingEvent $event) - // { - // global $user; - // if ($user->can("manage_admintools") && !empty($event->search_terms)) { - // $event->add_control($this->theme->dbq_html(Tag::implode($event->search_terms))); - // } - // } - - private function delete_by_query() - { - global $page; - $query = $_POST['query']; - $reason = @$_POST['reason']; - - assert(strlen($query) > 1); - - $images = Image::find_images(0, 1000000, Tag::explode($query)); - $count = count($images); - log_warning("admin", "Mass-deleting $count images from $query", "Mass deleted $count images"); - foreach ($images as $image) { - if ($reason && class_exists("ImageBan")) { - send_event(new AddImageHashBanEvent($image->hash, $reason)); - } - send_event(new ImageDeletionEvent($image, true)); - } - - $page->set_mode(PageMode::REDIRECT); - $page->set_redirect(make_link("post/list")); - return false; - } - private function set_tag_case() { global $database; diff --git a/ext/admin/theme.php b/ext/admin/theme.php index 5fca85f2..bfed9d2a 100644 --- a/ext/admin/theme.php +++ b/ext/admin/theme.php @@ -56,28 +56,4 @@ class AdminPageTheme extends Themelet $html .= "\n"; $page->add_block(new Block("Set Tag Case", $html)); } - - public function dbq_html($terms) - { - $h_terms = html_escape($terms); - - $warning = ""; - if (Extension::is_enabled(TrashInfo::KEY)) { - $warning = "This delete method will bypass the trash
"; - } - - $h_reason = ""; - if (class_exists("ImageBan")) { - $h_reason = ""; - } - - $html = $warning.make_form(make_link("admin/delete_by_query"), "POST") . " - - - $h_reason - - - "; - return $html; - } }