remove delete-by-query - bulk actions does the same thing better
This commit is contained in:
parent
d1001b55de
commit
5a7af0f083
2 changed files with 0 additions and 55 deletions
|
@ -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;
|
||||
|
|
|
@ -56,28 +56,4 @@ class AdminPageTheme extends Themelet
|
|||
$html .= "</form>\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<br/>";
|
||||
}
|
||||
|
||||
$h_reason = "";
|
||||
if (class_exists("ImageBan")) {
|
||||
$h_reason = "<input type='text' name='reason' placeholder='Ban reason (leave blank to not ban)'>";
|
||||
}
|
||||
|
||||
$html = $warning.make_form(make_link("admin/delete_by_query"), "POST") . "
|
||||
<input type='button' class='shm-unlocker' data-unlock-sel='#dbqsubmit' value='Unlock'>
|
||||
<input type='hidden' name='query' value='$h_terms'>
|
||||
$h_reason
|
||||
<input type='submit' id='dbqsubmit' disabled='true' value='Delete All These Images'>
|
||||
</form>
|
||||
";
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue